refactor: convert scheduler to typed module

This commit is contained in:
sjg
2026-08-01 13:23:30 +02:00
parent c7994347e9
commit 0338c8b8d2
11 changed files with 1747 additions and 1533 deletions
@@ -1258,7 +1258,7 @@ function applyRigList(activeRigId, rigIds, displayNames) {
updateRigIdentitySummary(lastActiveRigId);
window.trxUi?.setActiveRig(lastActiveRigId);
if (rigListChanged) {
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
window.trx.modules.scheduler?.setRig(lastActiveRigId);
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
if (typeof bmPopulateScopePicker === "function") bmPopulateScopePicker();
if (typeof bmFetch === "function") bmFetch(document.getElementById("bm-category-filter")?.value || "");
@@ -3593,7 +3593,7 @@ async function switchRigFromSelect(selectEl) {
updateRigSubtitle(lastActiveRigId);
updateRigIdentitySummary(lastActiveRigId);
window.trxUi?.setActiveRig(lastActiveRigId);
if (typeof setSchedulerRig === "function") setSchedulerRig(lastActiveRigId);
window.trx.modules.scheduler?.setRig(lastActiveRigId);
if (typeof setBackgroundDecodeRig === "function") setBackgroundDecodeRig(lastActiveRigId);
if (typeof bmFetch === "function") bmFetch(document.getElementById("bm-category-filter")?.value || "");
window.trx.modules.map?.syncAprsReceiverMarker();
@@ -4333,10 +4333,8 @@ async function initializeApp() {
}
}
function initSettingsUI() {
if (typeof initScheduler === "function") {
initScheduler(lastActiveRigId, authRole);
wireSchedulerEvents();
}
window.trx.modules.scheduler?.initialize(lastActiveRigId, authRole);
window.trx.modules.scheduler?.wireEvents();
if (typeof initBackgroundDecode === "function") {
initBackgroundDecode(lastActiveRigId, authRole);
wireBackgroundDecodeEvents();
@@ -10,7 +10,7 @@ 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"]);
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");
@@ -24,8 +24,9 @@
centerHz: document.getElementById("scheduler-sat-center-hz")
};
let editIdx = null;
let eventsWired = false;
function getBridge() {
return satSchedulerWindow.schedulerBridge ?? null;
return satSchedulerWindow.trx?.modules?.scheduler ?? null;
}
function getConfig() {
const b = getBridge();
@@ -230,6 +231,8 @@
if (dom.norad) dom.norad.value = parts[1] || "";
}
function wireEvents() {
if (eventsWired) return;
eventsWired = true;
if (dom.enabled) {
const enabledInput = dom.enabled;
dom.enabled.addEventListener("change", function() {
@@ -255,5 +258,9 @@
renderPassStatus,
collectSatelliteConfig
};
if (getBridge()) {
wireEvents();
renderSection();
}
})();
})();
File diff suppressed because it is too large Load Diff