UNPKG

@figliolia/react-hooks

Version:

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

13 lines (12 loc) 291 B
import { DeferFN } from "./DeferFN.js"; export class Throttler extends DeferFN { execute = (...args) => { if (this.ID) { return; } this.callback(...args); this.ID = setTimeout(() => { this.cancel(); }, this.wait); }; }