-
Notifications
You must be signed in to change notification settings - Fork 11
API
Determines if undo operations can be done
Determines if redo operations can be done
Undo the specified amount of changes that were recorded on the root machine and its children
Params:
- numUndos ( Number ): Amount of undo operations to do. Defaults to 1
- options ( Object ):
- on ( Array ): Only run undo operations on the given keys
- excludes ( Array ): Exclude undo operations on the given keys
Returns:
( Array ) All records that were undone
timeMachine.undo(); // Undo the last recorded change
timeMachine.undo(5, { on: ['firstName'] }); // Undo the last 5 changes to firstNameUndo all changes that were recorded on the root machine and its children
Params:
- options ( Object ):
- on ( Array ): Run all undo operations on the given keys
- excludes ( Array ): Exclude undo operations on the given keys
Returns:
( Array ) All records that were undone
timeMachine.undoAll();
timeMachine.undoAll({ on: ['tasks.@each.isCompleted'], excludes: ['tasks.0.isCompleted'] });Redo the specified amount of changes that were undone on the root machine and its children
Params:
- numRedos ( Number ): Amount of redo operations to do. Defaults to 1
- options ( Object ):
- on ( Array ): Only run redo operations on the given keys
- excludes ( Array ): Exclude redo operations on the given keys
Returns:
( Array ) All records that were redone
timeMachine.redo(); // Redo the last undo operation
timeMachine.redo(5, { on: ['firstName'] }); // Redo the last 5 undo operation to firstNameRedo all changes that were undone on the root machine and its children
Params:
- options ( Object ):
- on ( Array ): Run all redo operations on the given keys
- excludes ( Array ): Exclude redo operations on the given keys
Returns:
( Array ) All records that were redone
timeMachine.redoAll();
timeMachine.redoAll({ on: ['tasks.@each.isCompleted'], excludes: ['tasks.0.isCompleted'] });Clears all recorded changes and resets the state of the root machine and all its children
timeMachine.commit();Invokes the named method on the receiver or on every object if the receiver is an array
Params:
- methodName ( String ) : The name of the method
- args ( Object... ): Optional arguments to pass
Returns:
( Unknown ) Values from calling invoke
timeMachine.invoke('save'); // === timeMachine.get('content').save();
timeMachine.invoke('set', 'foo', 'bar'); // === timeMachine.get('content').set('foo', 'bar');Neatly prints all current records to console
Params:
- properties ( Array ) : Override for which properties to be displayed
timeMachine.printRecords();
timeMachine.printRecords(['key', 'before', 'after']);