summaryrefslogtreecommitdiff
path: root/js/timers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/timers.ts')
-rw-r--r--js/timers.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/js/timers.ts b/js/timers.ts
index 28de13d38..58367c1ea 100644
--- a/js/timers.ts
+++ b/js/timers.ts
@@ -197,6 +197,7 @@ function setTimer<Args extends Array<unknown>>(
return timer.id;
}
+/** Sets a timer which executes a function once after the timer expires. */
export function setTimeout<Args extends Array<unknown>>(
cb: (...args: Args) => void,
delay: number,
@@ -205,6 +206,7 @@ export function setTimeout<Args extends Array<unknown>>(
return setTimer(cb, delay, args, false);
}
+/** Repeatedly calls a function , with a fixed time delay between each call. */
export function setInterval<Args extends Array<unknown>>(
cb: (...args: Args) => void,
delay: number,
@@ -213,6 +215,7 @@ export function setInterval<Args extends Array<unknown>>(
return setTimer(cb, delay, args, true);
}
+/** Clears a previously set timer by id. */
export function clearTimer(id: number): void {
const timer = idMap.get(id);
if (timer === undefined) {