From bc4a1d780c273fbdfc4db1f2e99c84ae8d01ab9c Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Mon, 13 May 2024 19:05:30 +0530 Subject: [PATCH] code update for debounce --- scripts/aem.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/aem.js b/scripts/aem.js index 289e9ab..5d125e0 100644 --- a/scripts/aem.js +++ b/scripts/aem.js @@ -860,6 +860,14 @@ async function waitForLCP(lcpBlocks) { }); } +function debounce(func, timeout = 300) { + let timer; + return (...args) => { + clearTimeout(timer); + timer = setTimeout(() => { func.apply(this, args); }, timeout); + }; +} + init(); export { @@ -897,11 +905,3 @@ export { getFormMeetingConfig, debounce, }; - -export function debounce(func, timeout = 300) { - let timer; - return (...args) => { - clearTimeout(timer); - timer = setTimeout(() => { func.apply(this, args); }, timeout); - }; -}