Package | org.robotlegs.utilities.undoablecommand |
Class | public class UndoableCommandBase |
Inheritance | UndoableCommandBase ![]() |
Implements | IUndoableCommand |
Subclasses | UndoableCommand |
Property | Defined By | ||
---|---|---|---|
eventDispatcher : IEventDispatcher
Event bus to dispatch events on. | UndoableCommandBase |
Property | Defined By | ||
---|---|---|---|
hasExecuted : Boolean
Keeps track of whether this command has been executed,
to prevent undoing commands that have not been yet been executed. | UndoableCommandBase |
Method | Defined By | ||
---|---|---|---|
UndoableCommandBase(doFunction:Function = null, undoFunction:Function = null)
Creates a new UndoableCommand
| UndoableCommandBase | ||
execute():void
Executes the command. | UndoableCommandBase | ||
undo():void
Executes the undo function. | UndoableCommandBase |
Method | Defined By | ||
---|---|---|---|
doExecute():void
Subclasses MUST override this function with the body of their command. | UndoableCommandBase | ||
undoExecute():void
Subclasses must override this function. | UndoableCommandBase |
eventDispatcher | property |
eventDispatcher:IEventDispatcher
Event bus to dispatch events on.
public function get eventDispatcher():IEventDispatcher
public function set eventDispatcher(value:IEventDispatcher):void
hasExecuted | property |
protected var hasExecuted:Boolean
Keeps track of whether this command has been executed, to prevent undoing commands that have not been yet been executed.
UndoableCommandBase | () | Constructor |
public function UndoableCommandBase(doFunction:Function = null, undoFunction:Function = null)
Creates a new UndoableCommand
ParametersdoFunction:Function (default = null ) — the function to execute
| |
undoFunction:Function (default = null ) — execute this function to undo the operations of doFunction
|
doExecute | () | method |
protected function doExecute():void
Subclasses MUST override this function with the body of their command.
execute | () | method |
public final function execute():void
Executes the command. If we passed in an execute function to the constructor, execute passed-in function, otherwise execute overriden doExecute function. Will not execute more than once without first undoing
undo | () | method |
public final function undo():void
Executes the undo function. If we passed in an undo function to the constructor, execute passed-in undo function, otherwise execute overriden undoExecute function. Will not undo if function has not executed.
undoExecute | () | method |
protected function undoExecute():void
Subclasses must override this function. This function should undo whatever the doExecute command did.