RuntimeOptions
Stable · since 0.1.0
Section titled “inspector semantics”
The options bag passed to createRuntime. Every field is optional; omitting the argument constructs a runtime with all defaults.
Import
Section titled “Import”Definition
Section titled “Definition”Fields
Section titled “Fields”| Field | Type | Default | Description |
|---|---|---|---|
middleware | readonly Middleware[] | [] | Chain applied to every trigger in this runtime. Order matters for onFire / onSkip / onActionStart / onActionEnd / onError / onCascade. |
maxCascadeDepth | number | 3 | Maximum depth for action → fireEvent → … chains. Runs above this are skipped with 'overflow'. |
inspectorBufferSize | number | 50 | Ring-buffer size for the inspector. Ignored when the inspector is disabled. |
inspector | boolean | { dev?: boolean; prod?: boolean } | InspectorFactory | DEV true, PROD false (auto) | Per-run inspector switch. See below. v0.10+: pass createInspectorFactory() from @triggery/core/inspect for the bundle-friendly opt-in pattern. |
inspector semantics
Section titled “inspector semantics”| Value | Effect |
|---|---|
undefined (default) | Auto — on when process.env.NODE_ENV !== 'production', off otherwise. |
true | Always on, regardless of environment. |
false | Always off — hot path drops the snapshot allocation entirely (~30-40% extra throughput). |
{ dev?, prod? } | Per-environment override. Unset fields fall back to the auto default. |
InspectorFactory | v0.10+ — (bufferSize) => InspectorImpl factory. Pass createInspectorFactory() from @triggery/core/inspect so the inspector code stays out of the main bundle until the factory is imported. |
When disabled, runtime.subscribe callbacks never fire, runtime.getInspectorBuffer() returns [], and trigger.inspect() returns undefined. Devtools — @triggery/devtools-redux, @triggery/devtools-bridge, the React useInspectHistory hook — depend on the inspector being on.
Examples
Section titled “Examples”Defaults are fine for most apps
Section titled “Defaults are fine for most apps”Tighten cascade depth
Section titled “Tighten cascade depth”Larger inspector buffer
Section titled “Larger inspector buffer”Per-env inspector override
Section titled “Per-env inspector override”Hot-path benchmark mode
Section titled “Hot-path benchmark mode”Middleware chain
Section titled “Middleware chain”Related
Section titled “Related” createRuntime The constructor that consumes this type.
Middleware Hook shape of every middleware in the chain.
createInspector The ring-buffer implementation.
Cascade limits guide Why max-depth defaults to 3.