refactor: replace feature globals with typed services

This commit is contained in:
sjg
2026-08-01 16:05:40 +02:00
parent 3d49839ed5
commit 26a167cb82
16 changed files with 219 additions and 149 deletions
@@ -343,15 +343,13 @@ function bmApply(bm) {
bridge.scheduleSpectrumDraw();
}
const tunePromise = (async () => {
if (typeof bridge.vchanTakeSchedulerControl === "function") {
await bridge.vchanTakeSchedulerControl();
}
const onVirtual = typeof bridge.vchanInterceptMode === "function" && await bridge.vchanInterceptMode(bm.mode);
await bridge.trx?.modules?.vchan?.takeSchedulerControl();
const onVirtual = await bridge.trx?.modules?.vchan?.interceptMode(bm.mode) ?? false;
if (!onVirtual) {
await bridge.postPath("/set_mode?mode=" + encodeURIComponent(bm.mode));
}
if (bm.bandwidth_hz) {
const bwHandledByVchan = typeof bridge.vchanInterceptBandwidth === "function" && await bridge.vchanInterceptBandwidth(bm.bandwidth_hz);
const bwHandledByVchan = await bridge.trx?.modules?.vchan?.interceptBandwidth(bm.bandwidth_hz) ?? false;
if (!bwHandledByVchan) {
await bridge.postPath(`/set_bandwidth?hz=${bm.bandwidth_hz}`);
}
@@ -414,7 +412,10 @@ bridge.trx.modules.bookmarks = {
invalidateColors() {
bmOverlayRevision += 1;
},
apply: bmApply
apply: bmApply,
formatFrequency: bmFmtFreq,
fetch: bmFetch,
populateScopePicker: bmPopulateScopePicker
};
function bmUpdateSelectionUi() {
const count = bmSelected.size;