UNPKG

@figliolia/react-hooks

Version:

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

20 lines (19 loc) 526 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Throttler = void 0; const DeferFN_1 = require("./DeferFN"); class Throttler extends DeferFN_1.DeferFN { constructor() { super(...arguments); this.execute = (...args) => { if (this.ID) { return; } this.callback(...args); this.ID = setTimeout(() => { this.cancel(); }, this.wait); }; } } exports.Throttler = Throttler;