Action
MMO.core.history · 1 symbol · generated 30 Sep 2026
Action
history.js:6- Namespace
MMO.core.history
Index
| constructor(target, doFn, undoFn, state) | Create a new action | |
| execute() | Run the action, remembering what doFn returned so undo can restore it. | |
| undo() | Roll the action back. |
Methods3
constructor(target, doFn, undoFn, state)
history.js:15Create a new action
| target | Object | the targeted object |
| doFn | Function | MUST return an object with the property data. The value is passed to the undo action. |
| undoFn | Function | CAN return an object with the property data. The value is passed to the do action. if no data is returned, the first state is preserved and used in the do action. |
| state | * | a state to pass to the do action |
execute()
history.js:28Run the action, remembering what doFn returned so undo can restore it.
| returns | boolean | false when the action had already run |
undo()
history.js:40Roll the action back. When undoFn returns a value it becomes the state a later execute replays, otherwise the original state is reused.
| returns | boolean | false when the action was not in effect |