Constructor
new SuperTool(state)
Constructor initializes the state. If none is given, it defaults to {'great'}.
Parameters:
Name | Type | Description |
---|---|---|
state |
one of the SuperTool.state values |
- Source:
Throws:
if state is not a valid state
Members
(static) states
The possible states of the SuperTool.
- Source:
Methods
(static) validateState(value)
Validates a state. To be valid, the value needs to be part of the {SuperTool.states}.
Throws an Error if invalid. Returns void / undefined if passed.
Parameters:
Name | Type | Description |
---|---|---|
value |
The state candidate to be validated. |
- Source:
Throws:
if state is not a valid state
execute() → {string}
Executes with the current internal state.
- Source:
Returns:
the execution including the current state.
- Type
- string
state(value) → {String}
Validates and sets a new state value if given and returns the updated value. If no defined value is given it just returns the
current state value.
Parameters:
Name | Type | Description |
---|---|---|
value |
String | undefined | optional state to be set. |
- Source:
Returns:
the current state value
- Type
- String