Targets · JavaScript · Capabilities
Capabilities
Which high-level features a Program can actually use when it renders to JavaScript for the browser.
Contents
How a Program becomes JavaScript, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the JavaScript target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Coding standards — the Frenzi coding standards the generated code follows, global and JavaScript-specific.
- Example — a full program using every keyword, and the JavaScript it renders to.
- Naming considerations — how Program's dotted names are carried into JavaScript.
- Entry point — the generated
main()that wires up the drivers and starts the reactive cycle. - Drivers — the native drivers that provide capabilities like the user interface and animation, draining each cycle's emissions.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written, per-platform JavaScript behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to JavaScript.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words JavaScript keeps for itself, and how a Program name that collides with one is escaped.
What the browser can do
JavaScript for the browser is a rich, mature platform. The reactive core is host-agnostic; the drivers decide what a program can reach, and in the browser almost everything is available — usually built in.
| Feature | Status | How |
|---|---|---|
| User interface | Built in | The DOM interface driver renders Ui straight into the page; custom components wrap any DOM widget or library. |
| Networking | Built in | Network uses the platform fetch and WebSocket; no dependency. |
| Asynchrony | Built in | A LOCKED state models an in-flight value; the driver resolves it on a microtask and re-enters the cycle. No async/await in Program. |
| Animation | Built in | The Animate driver shares one requestAnimationFrame ticker. |
| Storage | Built in | Storage maps to localStorage / IndexedDB; file open and save go through the browser's picker and download. |
| Graphics | Built in | Canvas and WebGL are reachable through a custom interface component or a Graphics driver. |
| Location | Via the platform | Location uses the Geolocation API; a map is a custom component backed by a mapping library. |
| Background threads | Limited | The reactive cycle is single-threaded and cooperative. Heavy work can be pushed to a Web Worker behind a native module, but shared reactive state does not cross the boundary. |
| Local filesystem | Not directly | The browser sandbox has no arbitrary file access; only the user-driven file picker and downloads. A server or the Node build is needed for real files. |
Where a capability needs host code, it arrives as a NATIVE function or a driver — see native modules and drivers.