Skip to content

Commit

Permalink
Documentation and resoning
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeSimoes committed Jan 2, 2024
1 parent 5be5261 commit 6a11b13
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,15 @@ export async function init(node = document) {
const lcp = window.raqnLCP;
const prio = data.slice(0, 2);
const rest = data.slice(2);
Promise.all([
...lcp.map(({ name, el }) => {
const loader = new ComponentLoader(name, el);
return loader.decorate();
}),
...prio.map(({ name, el }) => {
const loader = new ComponentLoader(name, el);
return loader.decorate();
}),
]);
const start = ({ name, el }) => {
const loader = new ComponentLoader(name, el);
return loader.decorate();
};
Promise.all([...lcp.map(({ name, el }) => start({ name, el }))]);
setTimeout(() => {
Promise.all(
rest.map(({ name, el }) => {
const loader = new ComponentLoader(name, el);
return loader.decorate();
}),
...prio.map(({ name, el }) => start({ name, el })),
...rest.map(({ name, el }) => setTimeout(() => start({ name, el }))),
);
});
// reload on breakpoint change
Expand Down

0 comments on commit 6a11b13

Please sign in to comment.