Index

Action

MMO.core.history · 1 symbol · generated 5 Oct 2026

class

Action

history.js:6
class MMO.core.history.Action
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:15

Create a new action

constructor(target, doFn, undoFn, state)
targetObjectthe targeted object
doFnFunctionMUST return an object with the property data. The value is passed to the undo action.
undoFnFunctionCAN 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:28

Run the action, remembering what doFn returned so undo can restore it.

execute()
returnsbooleanfalse when the action had already run

undo()

history.js:40

Roll the action back. When undoFn returns a value it becomes the state a later execute replays, otherwise the original state is reused.

undo()
returnsbooleanfalse when the action was not in effect