@triggery/devtools-bridge
v0.10.0
Published
Page-side bridge for Triggery devtools — broadcasts runtime events over window.postMessage. Framework-agnostic. Zero runtime dependencies.
Maintainers
Readme
@triggery/devtools-bridge
Page-side bridge that makes a Triggery runtime observable to external tools — the Chrome extension, a future standalone web panel, custom inspectors, etc.
Install
pnpm add @triggery/devtools-bridgeUse
import { createRuntime } from '@triggery/core';
import { installDevtoolsBridge } from '@triggery/devtools-bridge';
const runtime = createRuntime();
if (import.meta.env.DEV) {
installDevtoolsBridge(runtime);
}That's it. The bridge:
- Exposes a discovery handle on
window.__triggery_devtools__so tools can detect the runtime. - Broadcasts a
triggery:hellopostMessagewith the currentgraph()+ inspector buffer. - Subscribes to the runtime and broadcasts a
triggery:snapshotfor every new run. - On
dispose(), removes the discovery handle and broadcasts atriggery:bye.
In Node / SSR installDevtoolsBridge returns a no-op disposer.
Wire format
{ source: 'triggery-devtools', type: 'triggery:hello', runtimeId, graph, buffer, at }
{ source: 'triggery-devtools', type: 'triggery:snapshot', runtimeId, snapshot, at }
{ source: 'triggery-devtools', type: 'triggery:bye', runtimeId, at }Documentation
Full documentation, recipes and API reference at https://triggeryjs.github.io/packages/devtools-bridge/.
Related packages
@triggery/core— Required peer.@triggery/devtools-panel— In-app inspector React components.@triggery/devtools-redux— Stream runtime events into the Redux DevTools extension.
See the full package list in the repo README.
License
MIT © Aleksey Skhomenko
