Subscribe to notifications on a specified channel, providing a callback function to handle received messages.
// Subscribe to a channel and specify a callback function
Eitri.eventBus.subscribe({
channel: "myChannel",
callback: (data) => {
// Handle the received data here
console.log('Received data:', data);
}
});
- API LEVEL
7
- Functionality added
Unsubscribe a callback function from receiving notifications on a specific channel.
- API LEVEL
7
- Functionality added
Publish data to a specific channel, notifying all subscribed listeners.
Eitri.eventBus.publish({
channel: "myChannel",
data: {
"a": 1
}
});
- API LEVEL
7
- Functionality added
Generated using TypeDoc
Event bus for messaging within your
eitri-app
, and for receiving events from the native app.Use it to implement a pub/sub pattern internally, or to handle external events triggered by the native side.