Skip to content

Commit

Permalink
chore: use events as trigger to load delayed.js
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnuescheler committed Oct 2, 2024
1 parent 7312419 commit 80d20fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ async function loadLazy(doc) {
function loadDelayed() {
// eslint-disable-next-line import/no-cycle
window.setTimeout(() => import('./delayed.js'), 3000);
// load anything that can be postponed to the latest here

// add other event-listeners that should trigger loading of delayed before timeout
document.addEventListener('scroll', () => import('./delayed.js'), { once: true });
}

async function loadPage() {
Expand Down

0 comments on commit 80d20fe

Please sign in to comment.