Show:
Extends EndPoint

Base states functionality for State and racks

Methods

close ()

Inherited from EndPoint: EndPoint.js:55

Closes the end point and stops listening for events.

This method no longer needs to be explicitly called as end points are now automatically closed when the last event listener is removed.

loadFirstState
(
  • delayed=false
)

Defined in States.js:99

Load the first state

Parameters:

  • [delayed=false] Boolean optional

    Whether to perform a delayed or immediate load

loadLastState
(
  • delayed=false
)

Defined in States.js:111

Load the last state

Parameters:

  • [delayed=false] Boolean optional

    Whether to perform a delayed or immediate load

loadNextState
(
  • direction
  • delayed=false
  • wrap=false
)

Defined in States.js:123

Load the next or previous state

Parameters:

  • direction Number

    Direction to move (1 = next, -1 = previous)

  • [delayed=false] Boolean optional

    Whether to perform a delayed or immediate load

  • [wrap=false] Boolean optional

    Whether to wrap around at the start/end

loadStateByIndex
(
  • index
  • delayed=false
)

Defined in States.js:71

Load the State at a given index position

Parameters:

  • index Number

    The zero based index of the State to load

  • [delayed=false] Boolean optional

    Whether to perform a delayed or immediate load

loadStateByProgram
(
  • index
  • delayed=false
)

Defined in States.js:85

Load the State with a given program number

Parameters:

  • index Number

    The zero based program number of the State to load

  • [delayed=false] Boolean optional

    Whether to perform a delayed or immediate load

open ()

Inherited from EndPoint: EndPoint.js:35

Opens this end point and starts listening for events.

This method no longer needs to be explicitly called as end points are now automatically opened when the first event listener is attached.

Use this method to keep the end point open even when no event listeners are attached.

untilOpen () Promise

Inherited from EndPoint: EndPoint.js:142

Returns a promise that will be resolved when this end point is opened

Returns:

Promise

Example:

let C = new CantabileApi();
   C.application.open();
await C.application.untilOpen();

Properties

currentState

State

Defined in States.js:63

The currently loaded State (or null if no active state). See also currentStateIndex.

currentStateIndex

Number

Defined in States.js:48

The index of the currently loaded State (or -1 if no active state). See also currentState.

items

State[]

Defined in States.js:34

An array of State items

name

String

Defined in States.js:41

The display name of the containing song or rack

Events

changed

Defined in States.js:174

Fired when anything about the contents of state list changes

currentStateChanged

Defined in States.js:251

Fired when the current state changes

itemAdded

Defined in States.js:167

Fired after a new state has been added

Event Payload:

  • index Number

    The zero based index of the newly added item

itemChanged

Defined in States.js:222

Fired when something about an state has changed

Event Payload:

  • index Number

    The zero based index of the item that changed

itemMoved

Defined in States.js:203

Fired when an item has been moved

Event Payload:

  • from Number

    The zero based index of the item before being moved

  • to Number

    The zero based index of the item's new position

itemRemoved

Defined in States.js:187

Fired after a state has been removed

Event Payload:

  • index Number

    The zero based index of the removed item

nameChanged

Defined in States.js:265

Fired when the name of the containing song or rack changes

reload

Defined in States.js:238

Fired when the entire set of states has changed (eg: after a sort operation, or loading a new song/rack)