Skip to content

Commit

Permalink
Merge pull request #309 from hlxsites/feature/coveo-implementation
Browse files Browse the repository at this point in the history
added debounce to export
  • Loading branch information
davenichols-DHLS authored May 13, 2024
2 parents bef9b20 + bc4a1d7 commit 2c7f91b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 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 @@ -895,12 +903,5 @@ export {
passFormMeetingConfig,
loadFormDelayed,
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 2c7f91b

Please sign in to comment.