mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-09 21:26:49 +08:00
parent
34659f471d
commit
4f8c5bb941
1 changed files with 3 additions and 2 deletions
|
@ -279,11 +279,12 @@ export function setLastSecondNotRound(): void {
|
|||
|
||||
export function calculateBurst(): number {
|
||||
const timeToWrite = (performance.now() - TestInput.currentBurstStart) / 1000;
|
||||
let wordLength;
|
||||
let wordLength: number;
|
||||
wordLength = TestInput.input.current.length;
|
||||
if (wordLength == 0) {
|
||||
wordLength = TestInput.input.getHistoryLast().length;
|
||||
wordLength = TestInput.input.getHistoryLast()?.length ?? 0;
|
||||
}
|
||||
if (wordLength == 0) return 0;
|
||||
const speed = Misc.roundTo2((wordLength * (60 / timeToWrite)) / 5);
|
||||
return Math.round(speed);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue