Skip to content

Commit

Permalink
code update for debounce
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitguptaGspann committed May 13, 2024
1 parent 699c441 commit bc4a1d7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
};
}

0 comments on commit bc4a1d7

Please sign in to comment.