feat(sim): F4.2 the sim protocol, the simulation room and LocalSimHost; M9 measured
packages/protocol holds the one list of /sim messages and checks every field, naming what is wrong. packages/sim has the simulation room for F and the web worker: the document's snapshot at start, the engine's clock on the wall clock with Java's speed as cable delay, subscriptions to cable activity, a card's new frames and a program's new window lines, capture and clock kept over a stop, the command line as first action, a core failure told to every client. LocalSimHost mirrors the document into the worker and back without echo. M9 in Chromium: 17 examples give the same capture as in Node, character for character; the room runs in a real worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// The entry of the web worker that holds a LocalSimHost's room.
|
||||
|
||||
import type { Port } from './channel.js';
|
||||
import { serveRoom } from './serveRoom.js';
|
||||
|
||||
// The worker's scope, with what it is used for here (the package has no DOM types).
|
||||
declare const self: Port;
|
||||
declare function setInterval(handler: () => void, milliseconds: number): unknown;
|
||||
declare const performance: { now(): number };
|
||||
|
||||
serveRoom(self, {
|
||||
now: () => performance.now(),
|
||||
seed: () => Math.floor(Math.random() * 2 ** 31),
|
||||
every: (milliseconds, tick) => setInterval(tick, milliseconds),
|
||||
});
|
||||
Reference in New Issue
Block a user