DebugFlag
See source codeTable of contents
Extends DebugFlagDef<T>, Atom<T>
.
interface DebugFlag<T> extends DebugFlagDef<T>, Atom<T> {}
Properties
defaults
defaults: DebugFlagDefaults<T>
lastChangedEpoch
The global epoch number when this signal's value last changed.
Note that this represents when the value actually changed, not when it was last computed. A computed signal may recalculate and produce the same value without changing its epoch. This is used internally for dependency tracking and history management.
lastChangedEpoch: number
name
name: string
shouldStoreForSession
shouldStoreForSession: boolean
Methods
get
Gets the current value of the signal and establishes a dependency relationship.
When called from within a computed signal or effect, this signal will be automatically tracked as a dependency. If this signal's value changes, any dependent computations or effects will be marked for re-execution.
getDiffSince
Gets the sequence of diffs that occurred between a specific epoch and the current state.
This method enables incremental synchronization by providing a list of changes that have occurred since a specific point in time. If the requested epoch is too far in the past or the signal doesn't have enough history, it returns the unique symbol RESET_VALUE to indicate that a full state reset is required.
Parameters
Name | Description |
---|---|
|
The epoch timestamp to get diffs since |
Returns
Diff[] | RESET_VALUE
An array of diff objects representing changes since the epoch, or the unique symbol RESET_VALUE if insufficient history is available
reset
set
Sets the value of this atom to the given value. If the value is the same as the current value, this is a no-op.
Parameters
Name | Description |
---|---|
|
The new value to set. |
|
The diff to use for the update. If not provided, the diff will be computed using AtomOptions.computeDiff. |
Returns
Value
update
Updates the value of this atom using the given updater function. If the returned value is the same as the current value, this is a no-op.
Parameters
Name | Description |
---|---|
|
A function that takes the current value and returns the new value. |
Returns
Value