The CommandContext method is a convenience wrapper around a simple object. This object allows for setting default properties and will also be able to interact with this object.


Methods

addRole (name, object, methods)

The addRole method will add a role to the current context. This role is only available for the current context, when a new one is generated/ created all the roles will be reset.

Parameters

Name Type Description
name String The name of the role.
object Object The object being presented the role.
methods Object The custom methods for the presented role.

Returned Value

CommandContext: The current context object.


clearRoles ()

The clearRoles method will clear the roles from the current context.

Returned Value

CommandContext: The current context object.


getProperty (property)

This method will return a property, only when set. If the property isn't set then false will be returned.

Parameters

Name Type Description
property String The property to return

Returned Value

: The found property or false.


getRole (name)

The getRole method returns the requested role. When the role isn't declared it will throw an error.

Parameters

Name Type Description
name String The requested role.

Returned Value

Object: The requested role.


setProperty (property, value)

The setProperty method will set a property with a value, when given an array to the property argument all the properties will be set.

When an array is given as the property the value property will be ignored.

Parameters

Name Type Description
property String| Array The propert(y/ies) to set.
value * The value of the property to set.

Returned Value

CommandContext