{@inheritDoc @thi.ng/api#INotify.addListener}
IWatch.addWatch()
implementation. Delegates to wrapped atom/cursor.
watch ID
watch function
Clears history & future stacks
Returns wrapped atom's current value.
{@inheritDoc @thi.ng/api#INotify.notify}
IWatch.notifyWatches()
implementation. Delegates to wrapped atom/cursor.
-
-
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.
state to record
Attempts to re-apply most recent value from future stack to atom and returns it if successful (i.e. there's a future).
{@inheritDoc @thi.ng/api#INotify.removeListener}
IWatch.removeWatch()
implementation. Delegates to wrapped atom/cursor.
watch iD
IReset.reset()
implementation. Delegates to wrapped atom/cursor, but too applies changed
predicate to determine if there was a change and if the previous value should be recorded.
replacement value
ISwap.swap()
implementation. Delegates to wrapped atom/cursor, but too applies changed
predicate to determine if there was a change and if the previous value should be recorded.
update function
additional args passed to fn
Attempts to re-apply most recent historical value to atom and returns it if successful (i.e. there's a history).
Generated using TypeDoc
Undo/redo history stack wrapper for atoms and cursors. Implements IAtom interface and so can be used directly in place and delegates to wrapped atom/cursor.
Value changes are only recorded in history if
changed
predicate returns truthy value, or else by calling History.record directly. This class too implements the INotify interface to support event listeners for History.undo, History.redo and History.record.