UNPKG
bonsai-analyzer
Version:
latest (0.4.0-alpha4)
0.4.0-alpha4
0.4.0-alpha3
0.4.0-alpha2
0.3.0
0.2.0
0.2.0-alpha.1
0.1.0
Trim your dependency tree.
github.com/pinterest/bonsai
pinterest/bonsai
bonsai-analyzer
/
src
/
utils
/
debounce.js
17 lines
(15 loc)
•
254 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* * @flow */
export
default
function
debounce
(
fn: () =>
void
, delay: number =
250
,
):
() =>
void
{
let
timer
: ?
TimeoutID
=
null
;
return
function
(
) {
if
(timer) {
clearTimeout
(timer); } timer =
setTimeout
(fn, delay); }; }