mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-17 22:29:52 +08:00
Merge branch 'master' into newads
This commit is contained in:
commit
87aebeaa47
1 changed files with 7 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import * as TestWords from "./test-words";
|
||||
import { roundTo2, stdDev, mean } from "../utils/misc";
|
||||
import * as TestStats from "./test-stats";
|
||||
|
||||
interface Keypress {
|
||||
count: number;
|
||||
|
|
@ -240,7 +241,12 @@ let newKeypresDurationArray: number[] = [];
|
|||
|
||||
export function recordKeyupTime(key: string): void {
|
||||
const now = performance.now();
|
||||
const diff = Math.abs(keysObj[key] - now);
|
||||
let diff = Math.abs(keysObj[key] - now);
|
||||
|
||||
if (isNaN(diff) && newKeypresDurationArray.length === 0) {
|
||||
diff = Math.abs(TestStats.start - now);
|
||||
}
|
||||
|
||||
newKeypresDurationArray.push(roundTo2(diff));
|
||||
delete keysObj[key];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue