mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-02-15 20:53:54 +00:00
parallelize script loads
This commit is contained in:
parent
9d3554de02
commit
2f23934de0
17 changed files with 561 additions and 68 deletions
|
|
@ -11,19 +11,20 @@ export function createScriptLoader(): ScriptLoader {
|
|||
try {
|
||||
url = getUrlForPath(path);
|
||||
} catch (err) {
|
||||
console.warn(`Script not in manifest: ${path}`, err);
|
||||
console.warn(`Script not in manifest: ${path} (${err})`);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
console.warn(`Script fetch failed: ${path} (${response.status})`);
|
||||
console.error(`Script fetch failed: ${path} (${response.status})`);
|
||||
return null;
|
||||
}
|
||||
return await response.text();
|
||||
} catch (err) {
|
||||
console.warn(`Script fetch error: ${path}`, err);
|
||||
console.error(`Script fetch error: ${path}`);
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue