mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: external module support
This commit is contained in:
1 parent
f020923d35
commit
86ead663df
8 files changed
+29
-11
No files matched your search
@@ -0,0 +1,10 @@
|
||||
export default async function loadExternalModule(target: string) {
|
||||
const ele = document.createElement('script');
|
||||
ele.src = target;
|
||||
await new Promise((resolve, reject) => {
|
||||
ele.onload = resolve;
|
||||
ele.onerror = reject;
|
||||
document.head.appendChild(ele);
|
||||
});
|
||||
return window.exports;
|
||||
}
|
||||
Reference in new issue
Block a user