Events

The Events described in Events are all available in the JavaScript SDK. There are some additional events that are specific to JavaScript which are covered in their own pages.

To listen to events use the on function:

voicelayer.on(event, callback);

event is the event name, callback is the function to be called when the event is triggered. The callback is called with a data argument which contains the payload for the event.

To stop listening to an event, you can use the off function:

voicelayer.off()                // stop listening to all events
voicelayer.off(event)           // stop listening to all events of type event
voicelayer.off(event, callback) // no longer call callback when event is triggered

Normally events are triggered as a result of a real-time event happening. However events can also be triggered manually with the trigger function:

voicelayer.trigger(event, payload)

Any callbacks that have been set up for event will be called. This can be useful when testing your callbacks.