index.ReactivityHooks
Global or scoped lifecycle hooks for reactive telemetry, profiling, and DevTools inspection.
Example
Optional onBatch(stats): void
Invoked during batch lifecycle events (start, flush, end).
| Name | Type | Description |
|---|---|---|
stats |
BatchStats |
Batch phase and count statistics. |
void
Optional onError(error, context): void
Invoked whenever an uncaught error occurs during reactive execution or hook dispatch.
| Name | Type | Description |
|---|---|---|
error |
unknown |
The error thrown. |
context |
Object |
Contextual information indicating the source, consumer, and phase of failure. |
context.consumer? |
ReactiveConsumer |
- |
context.phase |
string |
- |
context.source? |
ReactiveSource<unknown> |
- |
void
Optional onExecute(consumer, context): void
Invoked immediately before (start) and after (end) a consumer executes.
| Name | Type | Description |
|---|---|---|
consumer |
ReactiveConsumer |
The consumer subscriber being executed. |
context |
ExecutionContext |
Execution phase, duration in milliseconds, and any caught error. |
void
Optional onNotify(source, change): void
Invoked when a reactive source mutates and invalidates its downstream subscribers.
| Name | Type | Description |
|---|---|---|
source |
ReactiveSource<unknown> |
The reactive source node that changed. |
change |
ChangeEvent<unknown> |
Mutation details including old value, new value, and timestamp. |
void
Optional onSchedule(consumer): void
Invoked when the scheduler queues a consumer subscriber for deferred execution.
| Name | Type | Description |
|---|---|---|
consumer |
ReactiveConsumer |
The consumer subscriber queued for notification. |
void
Optional onTrack(source, consumer): void
Invoked when a consumer establishes a dependency edge by reading a reactive source.
| Name | Type | Description |
|---|---|---|
source |
ReactiveSource<unknown> |
The reactive source node being read. |
consumer |
ReactiveConsumer |
The active consumer subscriber establishing the dependency. |
void