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.

Compatibility Control

  • API LEVEL 7 - Functionality added

Hierarchy

  • EventBus

Methods

  • Unsubscribe a callback function from receiving notifications on a specific channel.

    Compatibility Control

    • API LEVEL 7 - Functionality added

    Parameters

    Returns void

  • Clear all listeners subscribed to a specific channel.

    Compatibility Control

    • API LEVEL 7 - Functionality added

    Parameters

    • channel: string

      The identifier of the channel for which to clear all listeners.

    Returns void

  • Publish data to a specific channel, notifying all subscribed listeners.

    Eitri.eventBus.publish({
    channel: "myChannel",
    data: {
    "a": 1
    }
    });

    Compatibility Control

    • API LEVEL 7 - Functionality added

    Parameters

    Returns void

  • 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);
    }
    });

    Compatibility Control

    • API LEVEL 7 - Functionality added

    Parameters

    Returns void

Generated using TypeDoc