Interface EventDispatcher<EventMap>

Provides the logging prefix for all logs made by this target.

interface EventDispatcher<in EventMap> {
    logPrefix: string;
    dispatch<K>(type: K, event: EventMap[K]): void;
}

Type Parameters

  • in EventMap

Hierarchy (view full)

Properties

Methods

Properties

logPrefix: string

A string prefix for all log statements made by this target.

Methods

  • Dispatches an event.

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • type: K

      The key of the event within EventMap

    • event: EventMap[K]

      If the passed event is read-only, then it may be re-used/cached. Otherwise, it should be a new event object every dispatch. If no target property is set on the event, the target will be set to this host.

    Returns void