// A launched bundle that asks for its events until the runtime takes the subscription — as a module // whose first ask may come too early does — and counts how often its one handler is handed an event. import { on } from "../../dist/events/index.js"; import { serveRegisteredOverStdio } from "../../dist/stdio/index.js"; let handled = 0; for (;;) { try { await on("radarr.download.completed", async () => { handled++; process.stderr.write(`handled ${handled}\n`); }); break; } catch (err) { process.stderr.write(`refused: ${err.message}\n`); } } await serveRegisteredOverStdio();