A Hub is an event manager. It allows to register event handler and to trigger events.
There are three hubs on the viewer:
- The state hub, available on
- The local context hub, available on
- The global context hub, available on
The interface of a hub is the following:
| ||A method that register an handler on the event name. When the event is emitted on the hub, the callback function is executed with the event payload as first argument. The |
| ||This method is the same as the |
| ||Cancel the corresponding subscription.|
| ||Emit an event with a optional payload.|
| ||Remove all subscriptions of this hub.|
Many of the events you may use are State events. Find more reading the State reference.