mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-28 08:43:07 +08:00
moved variable to a different module
This commit is contained in:
parent
063693be0a
commit
b659a68d9b
3 changed files with 8 additions and 9 deletions
|
@ -1,4 +1,3 @@
|
|||
import * as TestStats from "./test-stats";
|
||||
import * as TestWords from "./test-words";
|
||||
import * as TestUI from "./test-ui";
|
||||
import Config from "../config";
|
||||
|
@ -21,6 +20,12 @@ interface Settings {
|
|||
|
||||
export let settings: Settings | null = null;
|
||||
|
||||
let lastTestWpm = 0;
|
||||
|
||||
export function setLastTestWpm(wpm: number): void {
|
||||
lastTestWpm = wpm;
|
||||
}
|
||||
|
||||
function resetCaretPosition(): void {
|
||||
if (Config.paceCaret === "off" && !TestState.isPaceRepeat) return;
|
||||
if (!$("#paceCaret").hasClass("hidden")) {
|
||||
|
@ -87,7 +92,7 @@ export async function init(): Promise<void> {
|
|||
} else if (Config.paceCaret === "custom") {
|
||||
wpm = Config.paceCaretCustomSpeed;
|
||||
} else if (Config.paceCaret === "last" || TestState.isPaceRepeat === true) {
|
||||
wpm = TestStats.lastTestWpm;
|
||||
wpm = lastTestWpm;
|
||||
}
|
||||
if (wpm === undefined || wpm < 1 || Number.isNaN(wpm)) {
|
||||
settings = null;
|
||||
|
|
|
@ -845,7 +845,7 @@ function buildCompletedEvent(difficultyFailed: boolean): CompletedEvent {
|
|||
if (stats.time % 1 !== 0 && Config.mode !== "time") {
|
||||
TestStats.setLastSecondNotRound();
|
||||
}
|
||||
TestStats.setLastTestWpm(stats.wpm);
|
||||
PaceCaret.setLastTestWpm(stats.wpm);
|
||||
completedEvent.wpm = stats.wpm;
|
||||
completedEvent.rawWpm = stats.wpmRaw;
|
||||
completedEvent.charStats = [
|
||||
|
|
|
@ -35,12 +35,6 @@ export let start: number, end: number;
|
|||
export let start2: number, end2: number;
|
||||
export let lastSecondNotRound = false;
|
||||
|
||||
export let lastTestWpm = 0;
|
||||
|
||||
export function setLastTestWpm(wpm: number): void {
|
||||
lastTestWpm = wpm;
|
||||
}
|
||||
|
||||
export let lastResult: MonkeyTypes.Result<MonkeyTypes.Mode>;
|
||||
|
||||
export function setLastResult(
|
||||
|
|
Loading…
Reference in a new issue