StateOrganizer
Inherit:Organizer
Overview
StateOrganizer handles components' state.
Organizing
StateOrganizer waits for other components to become the specific states.
Sections
- waitFor
Timings
- all
Settings (Global)
Syntax:
{ "system": { "waitForTimeout": <waitForTimeout>, }, }
waitForTimeout
Type:Number
Specifies a default timeout in milliseconds to wait for other components when organizing.
Settings
Settings are placed in “waitFor” section.
Syntax:
{ "waitFor": { <eventName>: [{ "id": <id>, "name": <name>, "rootNode": <rootNode>, "state": <state> }] }, }
eventName
Type:String
An event name. Valid events are BitsmistJS events or Javascript original events.
id
Type:String
A component's unique id. The unique id can get from the component's uniqueId property.
name
Type:String
A component name.
rootNode
Type:String
A selector string that points to a node. Use syntax that is valid to querySelector().
state
Type:String
default:“started”
A state. It waits for the component to become this state. For the list of valid states, refer to "Extended Properties - state".
Tag attributes
bm-waitfor
Type:String
A component name to wait. Same as specifying a name in settings.
bm-waitfornode
Type:String
A node to wait. Same as specifying a rootNode in settings.
Extended Properties
state
Type:String
Inject:component
get/set
Returns a string that describes a component's current state. Valid states are:
- “starting”
- “started”
- “stopping”
- “stopped”
Extended Methods
changeState(state)
Type:undefined
Inject:Component
Change a component state to the specified state.
Paramters
Parameter | Type | Description |
---|---|---|
state Required | String | A string that describes a state of the component. Refer to "Extended Properties - state" for valid strings. |
Return Value
undefined
resume(state)
Type:undefined
Inject:Component
Asynchronous
Resume a component.
Paramters
Parameter | Type | Description |
---|---|---|
state Required | String | A string that describes a state of the component. Refer to "Extended Properties - state" for valid strings. |
Return Value
undefined
pause(state)
Type:undefined
Inject:Component
Asynchronous
Pause a component.
Paramters
Parameter | Type | Description |
---|---|---|
state Required | String | A string that describes a state of the component. Refer to "Extended Properties - state" for valid strings. |
Return Value
undefined
suspend(state)
Type:undefined
Inject:Component
Asynchronous
Suspend a component.
Paramters
Parameter | Type | Description |
---|---|---|
state Required | String | A string that describes a state of the component. Refer to "Extended Properties - state" for valid strings. |
Return Value
undefined
waitFor(waitList, timeout)
Type:undefined
Inject:Component
Asynchronous
Waits for other components to become a specific state.
Paramaters
Parameter | Type | Description |
---|---|---|
waitList Required | Array of Object | An array of objects that contain wait info. This is the same value as the value for <eventName> in settings. |
timeout Default:10000 | Number | A timeout period in milliseconds. Throws an error if the component does not become the state within this timeout value. |
Return Value
undefined