mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-28 08:43:07 +08:00
changed type of variable
This commit is contained in:
parent
35a6b910aa
commit
73ddb06339
2 changed files with 7 additions and 17 deletions
|
@ -72,10 +72,6 @@ const keysToTrack = [
|
|||
"NoCode", //android (smells) and some keyboards might send no location data - need to use this as a fallback
|
||||
];
|
||||
|
||||
interface Keypress {
|
||||
count: number;
|
||||
}
|
||||
|
||||
interface KeypressTimings {
|
||||
spacing: {
|
||||
first: number;
|
||||
|
@ -220,10 +216,8 @@ let keyDownData: Record<string, Keydata> = {};
|
|||
export const input = new Input();
|
||||
export const corrected = new Corrected();
|
||||
|
||||
export let keypressPerSecond: Keypress[] = [];
|
||||
let currentSecondKeypressData: Keypress = {
|
||||
count: 0,
|
||||
};
|
||||
export let keypressPerSecond: number[] = [];
|
||||
let currentSecondKeypressData = 0;
|
||||
export let currentBurstStart = 0;
|
||||
export let missedWords: {
|
||||
[word: string]: number;
|
||||
|
@ -265,7 +259,7 @@ export function enableSpacingDebug(): void {
|
|||
}
|
||||
|
||||
export function incrementKeypressCount(): void {
|
||||
currentSecondKeypressData.count++;
|
||||
currentSecondKeypressData++;
|
||||
}
|
||||
|
||||
export function setCurrentNotAfk(): void {
|
||||
|
@ -286,9 +280,7 @@ export function setBurstStart(time: number): void {
|
|||
|
||||
export function pushKeypressesToHistory(): void {
|
||||
keypressPerSecond.push(currentSecondKeypressData);
|
||||
currentSecondKeypressData = {
|
||||
count: 0,
|
||||
};
|
||||
currentSecondKeypressData = 0;
|
||||
}
|
||||
|
||||
export function pushAfkToHistory(): void {
|
||||
|
@ -491,9 +483,7 @@ export function restart(): void {
|
|||
rawHistory = [];
|
||||
burstHistory = [];
|
||||
keypressPerSecond = [];
|
||||
currentSecondKeypressData = {
|
||||
count: 0,
|
||||
};
|
||||
currentSecondKeypressData = 0;
|
||||
afkHistory = [];
|
||||
currentAfk = true;
|
||||
errorHistory = [];
|
||||
|
|
|
@ -869,8 +869,8 @@ function buildCompletedEvent(difficultyFailed: boolean): CompletedEvent {
|
|||
}
|
||||
|
||||
//consistency
|
||||
const rawPerSecond = TestInput.keypressPerSecond.map((f) =>
|
||||
Math.round((f.count / 5) * 60)
|
||||
const rawPerSecond = TestInput.keypressPerSecond.map((count) =>
|
||||
Math.round((count / 5) * 60)
|
||||
);
|
||||
|
||||
//adjust last second if last second is not round
|
||||
|
|
Loading…
Reference in a new issue