• Emits an event. Note events are always fired async.

    Type Parameters

    • T = unknown

    Parameters

    • target: any

      the channel object.

    • eventName: EventIdentifier

      event name

    • ...event: [] | [T]

      the event arguments

    Returns void

    // object as event channel
    const channel = {};

    // connect to event "changed"
    on(channel, "changed", (msg)=> console.log(msg));

    // fire changed event
    emit(channel, "changed", "my event msg");