A Signal is a reactive value container. The value may change over time, and it may keep track of the diffs between sequential values.
There are two types of signal:
- Atomic signals, created using atom. These are mutable references to values that can be changed using Atom.set.
- Computed signals, created using computed. These are values that are computed from other signals. They are recomputed lazily if their dependencies change.
The epoch when this signal's value last changed. Note tha this is not the same as when the value was last computed. A signal may recopmute it's value without changing it.
Defined in: signia/src/types.ts:36
The name of the signal. This is used at runtime for debugging and perf profiling only. It does not need to be globally unique.
Defined in: signia/src/types.ts:25
The current value of the signal. This is a reactive value, and will update when the signal changes. Any computed signal that depends on this signal will be lazily recomputed if this signal changes. Any effect that depends on this signal will be rescheduled if this signal changes.
Defined in: signia/src/types.ts:31
Returns the current value of the signal without capturing it as a dependency. Use this if you need to retrieve the signal's value in a hot loop where the performance overhead of dependency tracking is too high.
Defined in: signia/src/types.ts:47
Returns the sequence of diffs between the the value at the given epoch and the current value. Returns the RESET_VALUE constant if there is not enough information to compute the diff sequence.
getDiffSince(epoch: number): typeof RESET_VALUE | Diff;
Defined in: signia/src/types.ts:42