Skip to content

Commit 080be73

Browse files
committed
refactor the Scripts Loading snippet
1 parent 0d79fcd commit 080be73

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pages/Loading/Script-Loading.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ List all the `<scripts>` in the DOM and show a table to see if are loaded `async
88
const scripts = document.querySelectorAll("script[src]");
99

1010
const scriptsLoading = [...scripts].map((obj) => {
11-
let newObj = {};
12-
newObj = {
11+
return {
1312
src: obj.src,
1413
async: obj.async,
1514
defer: obj.defer,
1615
module: obj.type === 'module',
1716
"render blocking": obj.async || obj.defer || obj.type === 'module' ? "" : "🟥",
1817
};
19-
return newObj;
2018
});
2119

2220
console.table(scriptsLoading);

0 commit comments

Comments
 (0)