| 225 | } |
| 226 | |
| 227 | function 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 | |
| 249 | function playTimeWarning(): void { |
| 250 | if (timerDebug) console.time("play timer warning"); |