refactor: add typed decoder plugin runtime

This commit is contained in:
sjg
2026-08-01 13:02:54 +02:00
parent 6a83e2e90a
commit 508cf2ba87
23 changed files with 438 additions and 324 deletions
@@ -25,11 +25,14 @@ test("APRS entry normalizes positioned packets without remote symbol assets", as
Reflect,
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/aprs.js", import.meta.url), "utf8");
assert.equal(source.includes("raw.githubusercontent.com"), false);
new vm.Script(runtime).runInContext(context);
new vm.Script(source).runInContext(context);
window.onServerAprs({ src_call: "SP0ABC", dest_call: "APRS", crc_ok: true, lat: 54.5, lon: 18.5, symbol_table: "/", symbol_code: ">" });
window.trxPluginRuntime.dispatch("aprs", { src_call: "SP0ABC", dest_call: "APRS", crc_ok: true, lat: 54.5, lon: 18.5, symbol_table: "/", symbol_code: ">" });
assert.equal(window.onServerAprs, undefined);
assert.equal(forwarded.length, 1);
assert.equal(forwarded[0][0], "SP0ABC");
assert.equal(forwarded[0][1], 54.5);