To listen to events use the
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
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
Any callbacks that have been set up for
event will be called. This can be
useful when testing your callbacks.