Skip to content

Latest commit

 

History

History
32 lines (18 loc) · 1.05 KB

atom.history.record.md

File metadata and controls

32 lines (18 loc) · 1.05 KB

Home > @thi.ng/atom > History > record

History.record() method

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;

Parameters

Parameter Type Description
state T state to record

Returns:

void

Remarks

**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.