UNPKG
@figliolia/react-hooks
Version:
latest (1.7.3)
1.7.3
1.7.2
1.7.1
1.7.0
1.5.0
1.4.0
1.3.0
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.3
A small collection of simple React Hooks you're probably rewriting on a regular basis
@figliolia/react-hooks
/
dist
/
mjs
/
Generics
/
Debouncer.js
14 lines
(13 loc)
•
326 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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; } }