MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / checkIfTimeIsUp

Function checkIfTimeIsUp

frontend/src/ts/test/test-timer.ts:227–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

225}
226
227function checkIfTimeIsUp(): void {
228 if (timerDebug) console.time("times up check");
229 let maxTime = undefined;
230
231 if (Config.mode === "time") {
232 maxTime = Config.time;
233 } else if (Config.mode === "custom" && CustomText.getLimitMode() === "time") {
234 maxTime = CustomText.getLimitValue();
235 }
236 if (maxTime !== undefined && maxTime !== 0 && Time.get() >= maxTime) {
237 //times up
238 if (timer !== null) clearTimeout(timer);
239 Caret.hide();
240 SlowTimer.clear();
241 slowTimerCount = 0;
242 timerEvent.dispatch({ key: "finish" });
243 return;
244 }
245
246 if (timerDebug) console.timeEnd("times up check");
247}
248
249function playTimeWarning(): void {
250 if (timerDebug) console.time("play timer warning");

Callers 1

timerStepFunction · 0.85

Calls 3

dispatchMethod · 0.80
getMethod · 0.45
hideMethod · 0.45

Tested by

no test coverage detected