Function redispatchEvents

  • Listens to an event host for a list of events, re-dispatching those events on this target dispatcher. Useful for event delegation.

    Type Parameters

    • EventMap
    • K extends string | number | symbol

    Parameters

    • dispatcher: EventDispatcher<Pick<EventMap, K>>

      The dispatcher on which to re-dispatch events.

    • eventHost: ReadonlyEventHost<EventMap>

      The readonly event host that emits the events to be re-dispatched.

    • eventTypes: readonly K[]

      The event types from eventHost to delegate to the dispatcher. These are the keys in the event map that should be delegated.

    Returns Unsubscribe

    Returns a method that when invoked, will unsubscribe from all delegated events.