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
@@ -28,9 +28,12 @@ test("virtual channels expose typed SSE and interception boundaries", async () =
const source = await readFile(new URL("../../assets/web/generated/vchan.js", import.meta.url), "utf8");
new vm.Script(source).runInContext(context);
assert.equal(typeof window.vchanHandleSession, "function");
assert.equal(typeof window.vchanHandleChannels, "function");
assert.equal(typeof window.vchanApplyCapabilities, "function");
assert.equal(await window.vchanInterceptMode("USB"), false);
assert.equal(await window.vchanInterceptBandwidth(2400), false);
const service = window.trx.modules.vchan;
assert.equal(typeof service.handleSession, "function");
assert.equal(typeof service.handleChannels, "function");
assert.equal(typeof service.applyCapabilities, "function");
assert.equal(await service.interceptMode("USB"), false);
assert.equal(await service.interceptBandwidth(2400), false);
assert.equal(window.vchanHandleSession, undefined);
assert.equal(window.vchanInterceptBandwidth, undefined);
});