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) } }