Add service.

This commit is contained in:
JOLIMAITRE Matthieu 2025-05-26 23:09:47 +02:00
parent 4094afff3d
commit adfaa2afe2
6 changed files with 86 additions and 3 deletions

14
src/lib/debounce.ts Normal file
View file

@ -0,0 +1,14 @@
export class Debouncer {
last = 0
public constructor(
public timeout: number,
) {}
public should_skip() {
const now = Date.now()
const delay = now - this.last
this.last = now
return (delay < this.timeout)
}
}