API - CommandBehavior

Extends ObjectManager

This is the base class for every behavior, this holds the basic methods to let your behavior function properly.

Methods

This function will be available for every object, this will clone the current object.

Returns Object: An exact copy of the current object

This method will execute the given method, and will also give the given context over to the called method.

Parameters
Name Type Description
method String The method name to execute, this is dot-separated
context CommandContext The context object to use in the method call.

Returns CommandContext: The context object, which has gone through all the behaviors.

This is a private function to allow for config extending This method takes two parameters the first is the original config and the second will be appeneded to this one.

Parameters
Name Type Description
target Object The config object.
source Object The object to extend the config object.

Return the command chain to run behaviors.

Returns CommandChain: CommandChain object.

Use this function to acquire a variable from config.js

Parameters
Name Type Description
key String Key to specify the config to return

Returns Object: The requested config value.

Use this function to acquire the identifier object

Returns ObjectIdentifier: Identifier object.

Convert the action name to a function name.

Parameters
Name Type Description
method String The dot-separated name of the behavior

Returns String: The behavior name as function name.

This is a alias of ObjectManager.getObject to use in the "this" context.

Parameters
Name Type Description
identifier String Identifier of the object to load
config Object|null Config to push to the object

Returns Promise: call ".then" to use the object when ready.

This method will check if the function exists in the current behavior, if so it will return true,

Parameters
Name Type Description
method String The method name to check on.

Returns Boolean: The function exists or not.

Initialize override to allow the config to be used globally.

Parameters
Name Type Description
config Object The complete config object

Returns Object: The complete initialized object

This is the handler which will try to mixin functions from another object.

Parameters
Name Type Description
object Object The object to mix into the current object.

This method accepts an array or string as action parameter and will connect this action to a given method.

Parameters
Name Type Description
action Array|String The action or collection of actions to bind your method to.
method Function The function to call on the specified action(s).