Zimlet JavaScript API Reference - ZmActionStack

Class ZmActionStack


Creates a stack of undoable actions (ZmAction objects)

Defined in: ZmActionStack.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmActionStack(maxLength)
Method Summary
Method Attributes Method Name and Description
 
Returns whether the next undo action has completed
 
Returns whether there are actions that can be redone
 
Returns whether there are actions that can be undone
 
logAction(op, attrs, items, item, ids, id)
Logs a raw action, interpreting the params and creates a ZmAction object that is pushed onto the stack and returned
 
onComplete(callback)
Attaches a completion callback to the current action
 
redo()
Redoes the current action (if applicable) and moves the internal pointer
 
undo()
Undoes the current action (if applicable) and moves the internal pointer
Class Detail
ZmActionStack(maxLength)
Parameters:
{int} maxLength Optional
The maximum size of the stack. Defaults to 0, meaning no limit Adding actions to a full stack will pop the oldest actions off
Method Detail
actionIsComplete()
Returns whether the next undo action has completed

canRedo()
Returns whether there are actions that can be redone

canUndo()
Returns whether there are actions that can be undone

logAction(op, attrs, items, item, ids, id)
Logs a raw action, interpreting the params and creates a ZmAction object that is pushed onto the stack and returned
Parameters:
{String} op
operation to perform. Currently supported are "move", "trash", "spam" and "!spam"
{Hash} attrs Optional
attributes for the operation. Pretty much the same as what the backend expects, e.g. "l" for the destination folderId of a move
{String} items Optional
array of items to perform the action for. Valid types are specified in ZmActionStack.validTypes. Only one of [items],[item],[ids] or [id] should be specified; the first one found is used, ignoring the rest.
{String} item Optional
item to perform the action for, if there is only one item. Accomplishes the same as putting the item in an array and giving it as [items]
{String} ids Optional
array of ids of items to perform the action for.
{String} id Optional
id of item to perform the action for, if there is only one. Accomplishes the same as putting the id in an array and giving it as [ids].

onComplete(callback)
Attaches a completion callback to the current action
Parameters:
callback

redo()
Redoes the current action (if applicable) and moves the internal pointer

undo()
Undoes the current action (if applicable) and moves the internal pointer

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:38 GMT-0400 (EDT)