Highlighter

This commit is contained in:
Ian Gulliver
2024-12-22 14:59:03 -08:00
parent 3ac8302f11
commit 822a4891d0
8 changed files with 122 additions and 25 deletions

18
ts/singletimer.ts Normal file
View File

@@ -0,0 +1,18 @@
export class SingleTimer {
private callback: () => void;
private delay: number;
private timer: number | undefined;
constructor(callback: () => void, delay: number) {
this.callback = callback;
this.delay = delay;
}
public start() {
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(this.callback, this.delay);
}
}