Targets · TypeScript · Drivers
The native drivers that provide the interface, animation and network.
How a Program becomes TypeScript, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
A driver is a small typed object with a fixed shape — the channel it drains, whether that channel is a flat list or the nested tree, a setup hook, and a reconcile step:
Here is a console driver that satisfies it — it drains the Console.Lines channel and prints each line that has changed since the last cycle.
A program lists the drivers it uses; the runtime opens a channel for each and never hardcodes one. Each cycle it opens the channel, runs the reactive program (which emits into it), drains it, and hands the typed list to dispatch .
A driver that produces events — a timer, a network reply, an animation frame — calls the addUpdates it was given in init , which schedules the next cycle.
An embed lists exactly the drivers it needs.
The interface driver can be handed custom components a module provides — a map, a chart, a payment field. A custom component gives a name and a typed render that returns an HTMLElement .
Built-in and custom components register the same way, so program code cannot tell them apart. When something happens outside — a click, a response, a frame — the driver calls addUpdates , which schedules the next cycle: one direction out, one direction back.