StateChangedEvent class

The StateManager object dispatches a StateChangedEvent object when state data changes for a session or archive. There are two types of StateChangedEvent events:

  • changed — The StateManager dispatches this event for any changes in data.
  • changed:keyName — The StateManager dispatches this event when a specified key's value changes. For example, add an event listener for "key:foo" to listen to events when the value of the foo key changes.

The changedValues property of the StateChangedEvent object is an object containing properties that are key-value pairs of the changed state data.

For an example, see the StateManager documentation.

StateChangedEvent properties

The StateChangedEvent object has the following properties:

changedValues (Object) — An object containing properties that are key-value pairs of the changed data.

For the initial event dispatched, the changedValues property contains current state. For a changed event, it contains the entire current state, with a key-value pair for each property in the state. For a changed:keyName event, the initial event's changedValues property contains one property, pertaining to the specific key's (and the value is set to null if the key is not set in the state). An initial event is dispatched to each unique event listener you register, and the event's changedValues property reflects the state at the time you add the event listener.

For subsequent events (after the initial event), the changedValues property contains key-value pairs for changed properties in the state. For a changed:keyName event, the changedValues property contains one property, for the specific key, and the event is only dispatched when that key's value changes. A value is set to null when a key is deleted.

target (Object) — The StateManager object that dispatched the event.

type (String) — The type of event. The type property is either "changed" or of the form "changed:keyName".

See

Archive.getStateManager()

ChangeFailedEvent

Session.getStateManager()

StateManager

IRC Live Chat

Have a quick question? Chat with TokBox Support on IRC. Join chat