Bitsmist Frameworks
Docs » StateOrganizer

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

ParameterTypeDescription
state
Required
StringA 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

ParameterTypeDescription
state
Required
StringA 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

ParameterTypeDescription
state
Required
StringA 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

ParameterTypeDescription
state
Required
StringA 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

ParameterTypeDescription
waitList
Required
Array of ObjectAn array of objects that contain wait info. This is the same value as the value for <eventName> in settings.
timeout
Default:10000
NumberA timeout period in milliseconds. Throws an error if the component does not become the state within this timeout value.

Return Value

undefined

Previous Next

© 2019-2023 Masaki Yasutake

Bitsmist Frameworks

Table of Contents

Table of Contents

  • StateOrganizer
    • Overview
    • Organizing
    • Settings (Global)
      • waitForTimeout
    • Settings
      • eventName
      • id
      • name
      • rootNode
      • state
    • Tag attributes
      • bm-waitfor
      • bm-waitfornode
    • Extended Properties
      • state
    • Extended Methods
      • changeState(state)
      • resume(state)
      • pause(state)
      • suspend(state)
      • waitFor(waitList, timeout)

GENERAL

  • Overview
  • Installation
  • Create a sample component

COMPONENT

  • Loading
  • Settings
  • Events
  • Extending with organizers

REFERENCE - COMPONENT

  • Component

REFERENCE - ORGANIZER

  • EventOrganizer
  • LoaderOrganizer
  • OrganizerOrganizer
  • SettingOrganizer
  • StateOrganizer
  • TemplateOrganizer

REFERENCE - STORE

  • Store
  • ChainableStore

REFERENCE - UTILITY

  • AjaxUtil
  • ClassUtil
  • Util