refactor: convert map feature to strict TypeScript
This commit is contained in:
+3034
-3043
File diff suppressed because it is too large
Load Diff
+1
-15
@@ -10,25 +10,11 @@ const pluginGroups = {
|
||||
};
|
||||
const loaded = /* @__PURE__ */ new Set();
|
||||
const loading = /* @__PURE__ */ new Map();
|
||||
const modulePlugins = /* @__PURE__ */ new Set(["/ft8.js", "/ft4.js", "/ft2.js", "/wspr.js", "/cw.js", "/vdes.js", "/wefax.js", "/background-decode.js", "/ais.js", "/aprs.js", "/hf-aprs.js", "/sat.js", "/sat-scheduler.js", "/vchan.js", "/bookmarks.js", "/scheduler.js"]);
|
||||
function loadLegacyScript(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement("script");
|
||||
script.src = path;
|
||||
script.addEventListener("load", () => {
|
||||
resolve();
|
||||
}, { once: true });
|
||||
script.addEventListener("error", () => {
|
||||
reject(new Error(`Failed to load plugin script: ${path}`));
|
||||
}, { once: true });
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
}
|
||||
async function loadPlugin(path) {
|
||||
if (loaded.has(path)) return;
|
||||
const pending = loading.get(path);
|
||||
if (pending) return pending;
|
||||
const request = (modulePlugins.has(path) ? import(path).then(() => void 0) : loadLegacyScript(path)).then(() => {
|
||||
const request = import(path).then(() => {
|
||||
loaded.add(path);
|
||||
loading.delete(path);
|
||||
}).catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user