UNPKG

@figliolia/react-hooks

Version:

A small collection of simple React Hooks you're probably rewriting on a regular basis

20 lines (19 loc) 371 B
export class DeferFN { callback; wait; ID = null; constructor(callback, wait) { this.wait = wait; this.callback = callback; } update(...args) { this.wait = args[1]; this.callback = args[0]; } cancel() { if (this.ID) { clearTimeout(this.ID); this.ID = null; } } }