diff --git a/plugins/globals.ts b/plugins/globals.ts index 30511c693..0530df177 100644 --- a/plugins/globals.ts +++ b/plugins/globals.ts @@ -125,6 +125,7 @@ const plugin: Plugin = ({ app, store }, inject) => { resolve(); }); script.addEventListener('error', (event) => { + script.classList.add('loaded'); // not really loaded, but let's stop other calls from waiting forever, see !493 reject(new LoadScriptError(name, src, typeof event === 'string' ? event : event.type)); }); document.body.appendChild(script); @@ -149,8 +150,12 @@ const plugin: Plugin = ({ app, store }, inject) => { link.setAttribute('href', src); link.classList.add(`${name}-stylesheet`); link.crossOrigin = 'true'; - link.addEventListener('load', () => resolve()); + link.addEventListener('load', () => { + link.classList.add('loaded'); + resolve(); + }); link.addEventListener('error', (event) => { + link.classList.add('loaded'); // not really loaded, but let's stop other calls from waiting forever, see !493 reject(new LoadScriptError(name, src, typeof event === 'string' ? event : event.type)); }); document.body.appendChild(link);