@vizij/arora-web-wasm
v0.1.2
Published
Run a Vizij runtime in the browser as an Arora device: wasm bindings over arora-web's BrowserRuntime.
Readme
@vizij/arora-web-wasm
Run a Vizij runtime in the browser as an Arora device.
The wasm module (built from
crates/interop/vizij-arora-web)
assembles an arora-web BrowserRuntime
over the Vizij interop seams — a blackboard store, a rig HAL, and your node
graph as the device's behavior. One device, one store, one step loop: the
graph reads its input nodes' paths from the store each tick and writes its
outputs back, and JS talks to the same store.
Use
import { init, startDevice } from "@vizij/arora-web-wasm";
await init();
const device = await startDevice(graphSpec); // a Vizij graph spec (object or JSON)
// each animation frame (dt in ms, e.g. from requestAnimationFrame timestamps):
device.setValue("sensor/x", { f32: 0.75 });
device.step(dtMs);
const changes = device.drainChanges(); // path -> ValueJSON | null
device.dispose();Values cross the boundary in the normalized ValueJSON vocabulary from
@vizij/value-json;
setValue/writeValues accept its ValueInput shorthands.
Build
The pkg/ wasm artifacts are produced by wasm-pack from the repository root:
pnpm run build:wasm:arora-web # wasm-pack build -> npm/@vizij/arora-web-wasm/pkg
pnpm --filter @vizij/arora-web-wasm run build