EventBus
- Source:
Methods
(static) subscribe(callback, eventName, visualizer) → {symbol}
- Description:
Subscribes a callback function to an event, optionally for a specific event and/or visualizer instance.
- Source:
Example
const subscriptionId = WizartDeploymentKit.EventBus.subscribe((event) => {
console.log(event);
},
// if you want to handle specific event.
WizartDeploymentKit.VISUALIZER_EVENTS.USER_SESSION_STARTED,
// if you want to handle event of specific visualizer instance
visualizer
);
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | The callback function to execute when the event is triggered. |
eventName |
VisualizerEvent | null | Optional event name to subscribe to. |
visualizer |
Visualizer | null | Optional specific visualizer instance to filter events. |
Throws:
Will throw an error if callback is not a function or if visualizer is not a valid instance.
Returns:
A unique subscription ID for managing the subscription.
- Type
- symbol
(static) unsubscribe(subscriptionId)
- Description:
Unsubscribes from an event using the provided subscription ID.
- Source:
Example
WizartDeploymentKit.EventBus.unsubscribe(subscriptionId);
Parameters:
| Name | Type | Description |
|---|---|---|
subscriptionId |
symbol | The unique ID of the subscription to remove. |