mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-28 08:43:07 +08:00
using debug logs instead
This commit is contained in:
parent
5d09be09f2
commit
245daed4fc
3 changed files with 10 additions and 70 deletions
|
@ -424,9 +424,7 @@ function handleChar(
|
|||
return;
|
||||
}
|
||||
|
||||
if (TestInput.spacingDebug) {
|
||||
console.log("handleChar", char, charIndex, realInputValue);
|
||||
}
|
||||
console.debug("Handling char", char, charIndex, realInputValue);
|
||||
|
||||
const now = performance.now();
|
||||
|
||||
|
@ -1029,9 +1027,7 @@ $("#wordsInput").keydown((event) => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (TestInput.spacingDebug) {
|
||||
console.log("spacing debug keydown", event.key, event.code, event.which);
|
||||
}
|
||||
// console.debug("Event: keydown", event);
|
||||
|
||||
if (event.code === "NumpadEnter" && Config.funbox.includes("58008")) {
|
||||
event.code = "Space";
|
||||
|
@ -1060,9 +1056,7 @@ $("#wordsInput").keyup((event) => {
|
|||
return;
|
||||
}
|
||||
|
||||
if (TestInput.spacingDebug) {
|
||||
console.log("spacing debug keyup", event.key, event.code, event.which);
|
||||
}
|
||||
// console.debug("Event: keyup", event);
|
||||
|
||||
if (event.code === "NumpadEnter" && Config.funbox.includes("58008")) {
|
||||
event.code = "Space";
|
||||
|
|
|
@ -12,7 +12,6 @@ import * as TestStats from "./test/test-stats";
|
|||
import * as Replay from "./test/replay";
|
||||
import * as TestTimer from "./test/test-timer";
|
||||
import * as Result from "./test/result";
|
||||
import * as TestInput from "./test/test-input";
|
||||
import "./controllers/account-controller";
|
||||
import { enable } from "./states/glarses-mode";
|
||||
import "./test/caps-warning";
|
||||
|
@ -64,8 +63,6 @@ extendedGlobal.getTimerStats = TestTimer.getTimerStats;
|
|||
|
||||
extendedGlobal.toggleUnsmoothedRaw = Result.toggleUnsmoothedRaw;
|
||||
|
||||
extendedGlobal.enableSpacingDebug = TestInput.enableSpacingDebug;
|
||||
|
||||
extendedGlobal.egVideoListener = egVideoListener;
|
||||
|
||||
extendedGlobal.toggleDebugLogs = Logger.toggleDebugLogs;
|
||||
|
|
|
@ -252,12 +252,6 @@ let currentErrorHistory: ErrorHistoryObject = {
|
|||
export let afkHistory: boolean[] = [];
|
||||
let currentAfk = true;
|
||||
|
||||
export let spacingDebug = false;
|
||||
export function enableSpacingDebug(): void {
|
||||
spacingDebug = true;
|
||||
console.clear();
|
||||
}
|
||||
|
||||
export function incrementKeypressCount(): void {
|
||||
currentKeypressCount++;
|
||||
}
|
||||
|
@ -334,17 +328,8 @@ export function recordKeyupTime(now: number, key: string): void {
|
|||
|
||||
const diff = Math.abs(keyDownData[key].timestamp - now);
|
||||
keypressTimings.duration.array[keyDownData[key].index] = diff;
|
||||
if (spacingDebug) {
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"recorded",
|
||||
key,
|
||||
"durating array",
|
||||
keypressTimings.duration.array.length,
|
||||
"val",
|
||||
roundTo2(diff)
|
||||
);
|
||||
}
|
||||
|
||||
console.debug("Keyup recorded", key, diff);
|
||||
delete keyDownData[key];
|
||||
|
||||
updateOverlap(now);
|
||||
|
@ -352,15 +337,7 @@ export function recordKeyupTime(now: number, key: string): void {
|
|||
|
||||
export function recordKeydownTime(now: number, key: string): void {
|
||||
if (!keysToTrack.includes(key)) {
|
||||
if (spacingDebug) {
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"key not tracked",
|
||||
key,
|
||||
"spacing array",
|
||||
keypressTimings.spacing.array.length
|
||||
);
|
||||
}
|
||||
console.debug("Key not tracked", key);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -370,15 +347,7 @@ export function recordKeydownTime(now: number, key: string): void {
|
|||
}
|
||||
|
||||
if (keyDownData[key] !== undefined) {
|
||||
if (spacingDebug) {
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"key already down",
|
||||
key,
|
||||
"spacing array",
|
||||
keypressTimings.spacing.array.length
|
||||
);
|
||||
}
|
||||
console.debug("Key already down", key);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -393,24 +362,12 @@ export function recordKeydownTime(now: number, key: string): void {
|
|||
if (keypressTimings.spacing.last !== -1) {
|
||||
const diff = Math.abs(now - keypressTimings.spacing.last);
|
||||
keypressTimings.spacing.array.push(roundTo2(diff));
|
||||
if (spacingDebug) {
|
||||
console.log(
|
||||
"spacing debug",
|
||||
"recorded",
|
||||
key,
|
||||
"spacing array",
|
||||
keypressTimings.spacing.array.length,
|
||||
"val",
|
||||
roundTo2(diff)
|
||||
);
|
||||
}
|
||||
console.debug("Keydown recorded", key, diff);
|
||||
}
|
||||
keypressTimings.spacing.last = now;
|
||||
if (keypressTimings.spacing.first === -1) {
|
||||
keypressTimings.spacing.first = now;
|
||||
if (spacingDebug) {
|
||||
console.log("spacing debug", "saved first", now);
|
||||
}
|
||||
console.debug("First keydown recorded", key, now);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,12 +402,7 @@ export function resetKeypressTimings(): void {
|
|||
};
|
||||
keyDownData = {};
|
||||
noCodeIndex = 0;
|
||||
if (spacingDebug) {
|
||||
console.clear();
|
||||
if (spacingDebug) {
|
||||
console.log("spacing debug", "reset keypress timings");
|
||||
}
|
||||
}
|
||||
console.debug("Keypress timings reset");
|
||||
}
|
||||
|
||||
export function pushMissedWord(word: string): void {
|
||||
|
@ -507,7 +459,4 @@ export function restart(): void {
|
|||
array: [],
|
||||
},
|
||||
};
|
||||
if (spacingDebug) {
|
||||
console.log("spacing debug", "restart");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue