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 d8b8e98 commit 5568a88Copy full SHA for 5568a88
frontend masters/debounce.js
@@ -0,0 +1,18 @@
1
+function debounce(fn, delay) {
2
+ let timer;
3
+ return function () {
4
+ if (timer) {
5
+ clearTimeout(timer);
6
+ }
7
+ timer = setTimeout(() => {
8
+ fn.apply(this, arguments);
9
+ timer = null;
10
+ }, delay);
11
+ };
12
+}
13
+
14
+const getData = () => {
15
+ console.log("calling...");
16
+};
17
18
+debounce(getData, 500);
frontend masters/phonescreen/phonescreen.js
@@ -37,3 +37,4 @@ class Foods {
37
38
const foods = new Foods(rootElement, foodData);
39
foods.renderList();
40
0 commit comments