refactor: route all decoders through plugin runtime

This commit is contained in:
sjg
2026-08-01 13:06:38 +02:00
parent 508cf2ba87
commit 9fef0ebc7b
19 changed files with 255 additions and 319 deletions
@@ -19,12 +19,14 @@ test("WEFAX entry exposes typed lifecycle handlers and renders decoder state", a
Uint8Array,
console,
});
const runtime = await readFile(new URL("../../assets/web/generated/plugin-runtime.js", import.meta.url), "utf8");
const source = await readFile(new URL("../../assets/web/generated/wefax.js", import.meta.url), "utf8");
new vm.Script(runtime).runInContext(context);
new vm.Script(source).runInContext(context);
assert.equal(typeof window.onServerWefaxProgress, "function");
assert.equal(typeof window.restoreWefaxHistory, "function");
window.onServerWefaxProgress({ state: "Scanning 12 MHz" });
assert.equal(window.onServerWefaxProgress, undefined);
assert.equal(window.trxPluginRuntime.hasDecoder("wefax_progress"), true);
window.trxPluginRuntime.dispatch("wefax_progress", { state: "Scanning 12 MHz" });
assert.equal(status.textContent, "Scanning 12 MHz");
assert.equal(status.style.color, "var(--text-accent)");
});