mirror of https://github.com/shadowfacts/type.git
Update updateWPM
This commit is contained in:
parent
4ce5e72ccb
commit
e3643656ef
11
js/type.js
11
js/type.js
|
@ -570,15 +570,8 @@ function updateWPM() {
|
||||||
let words = typed.split(/[\s,\.]+/).length;
|
let words = typed.split(/[\s,\.]+/).length;
|
||||||
|
|
||||||
let seconds = elapsedTime / 1000;
|
let seconds = elapsedTime / 1000;
|
||||||
if (seconds >= 60) {
|
let minutes = seconds / 60;
|
||||||
// update real WPM
|
$("#wpm").text(Math.round(words / minutes));
|
||||||
let minutes = seconds / 60;
|
|
||||||
$("#wpm").text(Math.round(words / minutes));
|
|
||||||
} else {
|
|
||||||
// extrapolate forwards
|
|
||||||
let scaledWords = words / (seconds / 60);
|
|
||||||
$("#wpm").text(Math.round(scaledWords));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pause() {
|
function pause() {
|
||||||
|
|
Loading…
Reference in New Issue