Expose a global replay() function to get replay data (#1808)

This allows the data to be exported for analysis using the console, e.g.
with `copy(replay())`.  I expect it can be used in future as the basis
for the "ttr" file described in the TODO.
This commit is contained in:
Dean Scarff 2021-09-03 03:33:31 +10:00 committed by GitHub
parent 575d6dbf70
commit 439f4d1f1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -18,3 +18,5 @@ global.glarsesMode = toggleGlarses;
global.filterDebug = Account.toggleFilterDebug;
global.stats = TestStats.getStats;
global.replay = Replay.getReplayExport;

View file

@ -24,3 +24,4 @@ import "./ready";
import "./about-page";
import * as Account from "./account";
import * as TestStats from "./test-stats";
import * as Replay from "./replay";

View file

@ -256,6 +256,13 @@ function playReplay() {
);
}
function getReplayExport() {
return JSON.stringify({
replayData: replayData,
wordsList: wordsList,
});
}
$(".pageTest #playpauseReplayButton").click(async (event) => {
if (toggleButton.className === "fas fa-play") {
playReplay();
@ -293,4 +300,5 @@ export {
stopReplayRecording,
addReplayEvent,
replayGetWordsList,
getReplayExport,
};