Home > @thi.ng/atom > History > record
Records given state in history. This method is only needed when manually managing snapshots, i.e. when applying multiple swaps on the wrapped atom directly, but not wanting to create an history entry for each change.
Signature:
record(state?: T): void;
Parameter | Type | Description |
---|---|---|
state | T |
state to record |
Returns:
void
**DO NOT call this explicitly if using History.reset() / History.swap() etc.**
If no state
is given, uses the wrapped atom's current state value (user code SHOULD always call without arg).
If recording succeeded, the History.EVENT_RECORD
event is emitted with the recorded state provided as event value.