UNPKG

@figliolia/react-hooks

Version:

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

14 lines (13 loc) 326 B
import { DeferFN } from "./DeferFN.js"; export class Debouncer extends DeferFN { execute = (...args) => { this.cancel(); this.ID = setTimeout(() => { this.callback(...args); this.cancel(); }, this.wait); }; get hasActionPending() { return !!this.ID; } }