@figliolia/react-hooks
Version:
A small collection of simple React Hooks you're probably rewriting on a regular basis
21 lines (20 loc) • 553 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Debouncer = void 0;
const DeferFN_1 = require("./DeferFN");
class Debouncer extends DeferFN_1.DeferFN {
constructor() {
super(...arguments);
this.execute = (...args) => {
this.cancel();
this.ID = setTimeout(() => {
this.callback(...args);
this.cancel();
}, this.wait);
};
}
get hasActionPending() {
return !!this.ID;
}
}
exports.Debouncer = Debouncer;