Skip to main content

Crate reflow_rt_wasm

Crate reflow_rt_wasm 

Source
Expand description

Browser-WASM distribution of the Reflow runtime.

This crate wires up reflow_graph, reflow_actor, and reflow_network for the wasm32-unknown-unknown target via wasm-bindgen. Building it produces a .wasm + JS glue that an npm package can ship as @offbit-ai/reflow-wasm.

Usage in JS:

import init, { Graph, Network, Message } from "@offbit-ai/reflow-wasm";
await init();

const g = new Graph("demo");
g.addNode("a", "tpl_doubler");
g.addNode("b", "tpl_collector");
g.addConnection("a", "out", "b", "in");

const net = Network.fromGraph(g);
net.registerActorJs("tpl_doubler", { /* JS class with run(ctx) */ });
net.start();

For now the surface is intentionally narrow — Graph + Network + Message + the existing _* wasm-bindgen exports inherited from reflow_graph/reflow_network. The bundled component catalog (reflow_components) is excluded because its native-only deps (rquickjs, openh264, wgpu native backends, …) don’t compile to wasm32-unknown-unknown without significant feature-gating work. Author actors as JS classes via Network.registerActorJs(...).