We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10cb19b commit 0304586Copy full SHA for 0304586
debounce.js
@@ -0,0 +1,14 @@
1
+/*
2
+ invoke handler only if it is an action
3
+ was not taken in the last `delay` seconds
4
+ examples: typeahead
5
+*/
6
+const debounce = (handler, delay) => {
7
+ let debounceHandler = null;
8
+ return function () {
9
+ clearTimeout(timeoutHandler);
10
+ debounceHandler = setTimeout(() => {
11
+ handler.apply(this, arguments);
12
+ }, delay);
13
+ };
14
+}
0 commit comments