mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-20 15:26:15 +08:00
added spacing debugging
This commit is contained in:
parent
60d35a2a45
commit
029a17cf4d
|
@ -19,3 +19,5 @@ global.enableTimerDebug = TestTimer.enableTimerDebug;
|
|||
global.getTimerStats = TestTimer.getTimerStats;
|
||||
|
||||
global.toggleUnsmoothedRaw = Result.toggleUnsmoothedRaw;
|
||||
|
||||
global.enableSpacingDebug = TestStats.enableSpacingDebug;
|
||||
|
|
|
@ -703,6 +703,14 @@ $(document).keydown((event) => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (TestStats.spacingDebug)
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"keypress",
|
||||
event.key,
|
||||
"length",
|
||||
TestStats.keypressTimings.spacing.array.length
|
||||
);
|
||||
TestStats.recordKeypressSpacing();
|
||||
TestStats.setKeypressDuration(performance.now());
|
||||
TestStats.setKeypressNotAfk();
|
||||
|
|
|
@ -42,6 +42,12 @@ export let keypressTimings = {
|
|||
},
|
||||
};
|
||||
|
||||
export let spacingDebug = false;
|
||||
export function enableSpacingDebug() {
|
||||
spacingDebug = true;
|
||||
console.clear();
|
||||
}
|
||||
|
||||
export function getStats() {
|
||||
let ret = {
|
||||
start,
|
||||
|
@ -295,8 +301,31 @@ export function recordKeypressSpacing() {
|
|||
let diff = Math.abs(keypressTimings.spacing.current - now);
|
||||
if (keypressTimings.spacing.current !== -1) {
|
||||
pushKeypressSpacing(diff);
|
||||
if (spacingDebug)
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"push",
|
||||
diff,
|
||||
"length",
|
||||
keypressTimings.spacing.array.length
|
||||
);
|
||||
}
|
||||
setKeypressSpacing(now);
|
||||
if (spacingDebug)
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"set",
|
||||
now,
|
||||
"length",
|
||||
keypressTimings.spacing.array.length
|
||||
);
|
||||
if (spacingDebug)
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"recorded",
|
||||
"length",
|
||||
keypressTimings.spacing.array.length
|
||||
);
|
||||
}
|
||||
|
||||
export function resetKeypressTimings() {
|
||||
|
@ -310,6 +339,7 @@ export function resetKeypressTimings() {
|
|||
array: [],
|
||||
},
|
||||
};
|
||||
if (spacingDebug) console.clear();
|
||||
}
|
||||
|
||||
export function pushMissedWord(word) {
|
||||
|
|
Loading…
Reference in a new issue