@monimesl/dot-simulator
v0.1.0-alpha.21
Published
Browser host for Dot mini apps: runs the service in a Worker and the webview in a device frame
Readme
@monimesl/dot-simulator
The browser host for dots, used during development. dotctl dev starts it. It runs the service
bundle in a Worker and shows the webview in a phone-sized frame. It relays messages between them,
owns the navigation stack, and logs every message. See docs/hosts.md.
import { startSimulator } from '@monimesl/dot-simulator';
const simulator = await startSimulator({ dotDir: 'my-dot/dist', name: 'My dot', port: 3680 });
simulator.reload(); // restart the dot after a rebuild
simulator.error('view.dml:3:7: ...'); // show a build error over the phonesrc/server.tsserves the simulator page, the dot's bundles and the reload event stream. It injects the bridge into the webview'sindex.html, and runs Dash's network and storage calls.src/host.tshasstartHost(), which does what every host does. It relays messages, owns the navigation stack (NavigationStackfrom core) and announces it withsyncStack.src/client/holds the browser scripts.simulator.jsis the page, andwebview-bridge.jsandservice-bridge.jsinstall__hostTransportin each layer.
