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
/
DeferFN.js
20 lines
(19 loc)
•
371 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export
class
DeferFN
{ callback; wait; ID =
null
;
constructor
(callback, wait) {
this
.wait = wait;
this
.callback = callback; } update(...args) {
this
.wait = args[
1
];
this
.callback = args[
0
]; } cancel() {
if
(
this
.ID) { clearTimeout(
this
.ID);
this
.ID =
null
; } } }