Constructor
new Tracer()
Constructs the inactive tracer installed at import time.
- Source:
Members
on :boolean
Hot-path flag. Read by every instrumented site in the runtime, so it is a plain own property rather than a getter.
Type:
- boolean
- Source:
sink :object|null
The recorder receiving nodes, or null when tracing is off.
Type:
- object | null
- Source:
stack :Array:.<number:>
Ids of the nodes currently executing, innermost last.
Type:
- Source:
Methods
annotate(fields)
Attaches a field to the node most recently entered.
Used where the interesting value is only known once the node's body has run — a computed's new value, an action's return, a resource's outcome.
Parameters:
| Name | Type | Description |
|---|---|---|
fields |
object | Fields to merge into the open node. |
- Source:
attach(sink) → {Tracer}
Begins recording into a sink.
Parameters:
| Name | Type | Description |
|---|---|---|
sink |
object | The recorder to feed. |
- Source:
Returns:
This tracer.
- Type
- Tracer
continueFrom(id) → {number}
Re-enters an existing node's causal scope without recording a new node.
The scheduler batches component updates into a microtask, so the DOM patch caused by a click happens on an empty causal stack — long after the click handler returned. Stamping the queued job with the node that queued it and resuming that scope here is what keeps a patch attributed to the write that caused it, rather than appearing as an unexplained root.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | null | The node id to continue from. |
- Source:
Returns:
A restore token for leave, or -1 when tracing is off.
- Type
- number
current() → {number|null}
The id of the node currently being executed, or null at the top level.
- Source:
Returns:
The causal parent for anything emitted right now.
- Type
- number | null
detach() → {object|null}
Stops recording and drops the sink.
- Source:
Returns:
The detached recorder.
- Type
- object | null
enter(type, data) → {number}
Records a node and makes it the causal parent of everything emitted until the matching Tracer#leave.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | A TraceNodeType. |
data |
object | Type-specific fields. |
- Source:
Returns:
A restore token to hand to leave, or -1 when tracing is off.
- Type
- number
leave(token)
Restores the causal stack to the depth a matching enter returned.
Parameters:
| Name | Type | Description |
|---|---|---|
token |
number | The token from |
- Source:
markNonDeterministic(reason, detailopt)
Reports that something happened which replay cannot reproduce.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
reason |
string | A non-determinism reason. |
|
detail |
string |
<optional> |
Extra context shown to the developer. |
- Source:
record(type, data) → {object|null}
Records a leaf node — something that happened, but that nothing else happened inside.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | A TraceNodeType. |
data |
object | Type-specific fields. |
- Source:
Returns:
The stored node, or null when tracing is off.
- Type
- object | null
recordError(error, contextopt) → {object|null}
Records an error that escaped application code.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
error |
Error | The error. |
|
context |
object |
<optional> |
Where it came from. |
- Source:
Returns:
The stored node.
- Type
- object | null