mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: scratchpad: fix load race
This commit is contained in:
1 parent
265b14236a
commit
39e9b4a9cc
2 files changed
+7
-1
No files matched your search
@@ -28,8 +28,13 @@ const loaders = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let loadPromise = Promise.resolve();
|
||||||
|
|
||||||
export async function load(features = ['markdown']) {
|
export async function load(features = ['markdown']) {
|
||||||
let s = Date.now();
|
let s = Date.now();
|
||||||
|
await loadPromise;
|
||||||
|
let resolve;
|
||||||
|
loadPromise = new Promise((r) => { resolve = r; });
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
await loaders.i18n();
|
await loaders.i18n();
|
||||||
console.log('Loading monaco editor');
|
console.log('Loading monaco editor');
|
||||||
@@ -60,6 +65,7 @@ export async function load(features = ['markdown']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await res.loadThemePromise;
|
await res.loadThemePromise;
|
||||||
|
resolve();
|
||||||
return { monaco: res.default, registerAction: res.registerAction };
|
return { monaco: res.default, registerAction: res.registerAction };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.40.8",
|
"version": "4.40.9",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user