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
Tools for listening to events on your eitri-app coming from the main app.
You can also use this bus to implement a pub/sub pattern inside your eitri-app.