0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

[ci] format

This commit is contained in:
matthewp 2023-07-25 12:38:25 +00:00 committed by astrobot-houston
parent 188eeddd47
commit 0c1a26adc8

View file

@ -43,12 +43,14 @@ const { fallback = 'animate' } = Astro.props as Props;
function runScripts() { function runScripts() {
let wait = Promise.resolve(); let wait = Promise.resolve();
for(const script of Array.from(document.scripts)) { for (const script of Array.from(document.scripts)) {
const s = document.createElement('script'); const s = document.createElement('script');
s.innerHTML = script.innerHTML; s.innerHTML = script.innerHTML;
for(const attr of script.attributes) { for (const attr of script.attributes) {
if(attr.name === 'src') { if (attr.name === 'src') {
const p = new Promise(r => {s.onload = r}); const p = new Promise((r) => {
s.onload = r;
});
wait = wait.then(() => p as any); wait = wait.then(() => p as any);
} }
s.setAttribute(attr.name, attr.value); s.setAttribute(attr.name, attr.value);
@ -191,6 +193,6 @@ const { fallback = 'animate' } = Astro.props as Props;
{ passive: true, capture: true } { passive: true, capture: true }
); );
}); });
addEventListener('load', onload) addEventListener('load', onload);
} }
</script> </script>