Sign in
apache
/
doris-website
/
refs/heads/opt-var-nested
/
.
/
src
/
utils
/
debounce.ts
blob: 171aceeb57d927dc66aa45b71957e86ba345c98c [
file
] [
log
] [
blame
]
export
const
debounce
=
(
fn
,
wait
=
300
,
that
=
null
)
=>
{
let
timeout
:
NodeJS
.
Timeout
;
return
(...
args
)
=>
{
if
(
timeout
)
clearTimeout
(
timeout
);
timeout
=
setTimeout
(()
=>
{
fn
.
apply
(
that
??
this
,
args
);
},
wait
);
};
};