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

Load the first state

Parameters:

  • [delayed=false] Boolean optional

    Whether to perform a delayed or immediate load

loadLastState
(
  • delayed=false
)

Defined in 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
)

Defined in 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
)

Defined in 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
)

Defined in 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

Defined in States.js:62

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

currentStateIndex

Number

Defined in States.js:48

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

items

State[]

Defined in States.js:34

An array of states

name

String

Defined in States.js:41

The display name of the containing song or rack

Events

changed

Defined in States.js:172

Fired when anything about the contents of state list changes

currentStateChanged

Defined in States.js:249

Fired when the current state changes

itemAdded

Defined in 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

Defined in 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

Defined in 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

Defined in States.js:185

Fired after a state has been removed

Event Payload:

  • index Number

    The zero based index of the removed item

nameChanged

Defined in States.js:263

Fired when the name of the containing song or rack changes

reload

Defined in States.js:236

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