The best way to control Claude Code, Codex and more from any computer or phone

main
ts 20 lines 675 Bytes
Raw
1 /// <reference types="vite/client" />
2 // Mirrors `playground/hot-channel/src/index.ts`, recording the events it
3 // receives (the playground logs them) so the test can read them back.
4 const received = new Set<string>();
5
6 import.meta.hot?.on("server-event", (payload: string) => {
7 received.add(`__${payload}-received__`);
8 import.meta.hot?.send("worker-event", "worker-module-event-data");
9 });
10
11 import.meta.hot?.on("worker-event-received", (payload: string) => {
12 received.add(`__${payload}-received__`);
13 });
14
15 export default {
16 async fetch() {
17 import.meta.hot?.send("worker-event", "worker-request-event-data");
18 return Response.json([...received].sort());
19 },
20 };