Show:
Extends States

Interface to the states of the current song

Access this object via the songStates property.

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
)

Inherited from States: States.js:97

Load the first state

Parameters:

  • [delayed=false] Boolean optional
    Whether to perform a delayed or immediate load
loadLastState
(
  • delayed=false
)

Inherited from States: States.js:109

Load the last state

Parameters:

  • [delayed=false] Boolean optional
    Whether to perform a delayed or immediate load
loadNextState
(
  • direction
  • delayed=false
  • wrap=false
)

Inherited from States: States.js:121

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
)

Inherited from States: States.js:69

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
)

Inherited from States: States.js:83

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:137

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

Inherited from States: States.js:62

The currently loaded item (or null if no active state)

currentStateIndex

Number

Inherited from States: States.js:48

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

items

State[]

Inherited from States: States.js:34

An array of states

name

String

Inherited from States: States.js:41

The display name of the containing song or rack

Events

changed

Inherited from States: States.js:172

Fired when anything about the contents of state list changes

currentStateChanged

Inherited from States: States.js:249

Fired when the current state changes

itemAdded

Inherited from States: States.js:165

Fired after a new state has been added

Event Payload:

  • index Number
    The zero based index of the newly added item

itemChanged

Inherited from States: States.js:220

Fired when something about an state has changed

Event Payload:

  • index Number
    The zero based index of the item that changed

itemMoved

Inherited from States: States.js:201

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

Inherited from States: States.js:185

Fired after a state has been removed

Event Payload:

  • index Number
    The zero based index of the removed item

nameChanged

Inherited from States: States.js:263

Fired when the name of the containing song or rack changes

reload

Inherited from States: States.js:236

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