API Docs for:
Show:

PerformableAction Class

Defined in: src/action.js:4

A performable action implementation. Handles the resolution of a source object performing an action on a target object. Performable action logic is attached to and primarily related to the source. Methods on this object should only be called by the {{#crossLink "PerformableActionInterface"}}

If any of the functions on this object should always return true or false it can be set to a Boolean value that will be used instead of the value returned by calling the function.

Methods

afterPerformActionSuccess

(
  • target
  • [settings]
)
Array

Defined in src/action.js:66

Optional function called after action is resolved successfully.

Parameters:

  • target Object
    • The target to perform the action on.
  • [settings] Object optional
    • Settings for the action.

Returns:

Array:

Array of valid targets.

afterPerformActionSuccess

(
  • target
  • [settings]
)
Array

Defined in src/action.js:75

Optional function called after action is resolved un-successfully.

Parameters:

  • target Object
    • The target to perform the action on.
  • [settings] Object optional
    • Settings for the action.

Returns:

Array:

Array of valid targets.

canPerformAction

(
  • settings
)
Bool

Defined in src/action.js:19

Checks if the entity with this PerformableAction can currently perform the action. Instead of a function this.canPerformAction can be set to a boolean value if the check should always be true or false.

If this functions should always return true or false it can be set to a Boolean value that will be used instead of the value returned by calling the function.

Parameters:

  • settings Object
    • The settings for the action.

Returns:

Bool:

canPerformActionOnTarget

(
  • target
  • settings
)
Bool

Defined in src/action.js:32

Checks if the entity with this PerformableAction can currently perform the action on given target.

If this functions should always return true or false it can be set to a Boolean value that will be used instead of the value returned by calling the function.

Parameters:

  • target Object
    • The target to perform the action on.
  • settings Object
    • The settings for the action.

Returns:

Bool:

getTargetsForAction

(
  • [settings]
)
Array

Defined in src/action.js:58

Returns a list of valid targets to perform this action on.

Parameters:

  • [settings] Object optional
    • Settings for the action.

Returns:

Array:

Array of valid targets.

performAction

(
  • target
  • settings
)
Bool

Defined in src/action.js:45

Performs this PerformableAction from source on target using settings.

If this functions should always return true or false it can be set to a Boolean value that will be used instead of the value returned by calling the function.

Parameters:

  • target Object
    • The target to perform the action on.
  • settings Object
    • The settings for the action.

Returns:

Bool: