Skip to content

Commit

Permalink
#414986 > await and on load
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeSimoes committed Jan 9, 2024
1 parent d0fd0c5 commit d4ccf4f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ export async function init(node = document) {
return loader.decorate();
};

Promise.all([
await Promise.all([
...lcp.map(({ name, el }) => start({ name, el })),
...priority.map(({ name, el }) => start({ name, el })),
]);

// if (!loaded) {
// window.addEventListener('load', () => {
// loaded = true;
// return rest.map(({ name, el }) => setTimeout(() => start({ name, el })));
// });
// } else {
rest.map(({ name, el }) => setTimeout(() => start({ name, el })));
// }
if (!loaded) {
window.addEventListener('load', () => {
loaded = true;
return rest.map(({ name, el }) => setTimeout(() => start({ name, el })));
});
} else {
rest.map(({ name, el }) => setTimeout(() => start({ name, el })));
}

// reload on breakpoint change
window.raqnBreakpoint = getBreakPoint();
Expand Down

0 comments on commit d4ccf4f

Please sign in to comment.