Options
All
  • Public
  • Public/Protected
  • All
Menu

@jjwesterkamp/event-delegation

Index

Type aliases

Build

Build<M, R>: M extends "MANY" ? EventHandler<R>[] : M extends "SINGLE" ? EventHandler<R> : never

Type parameters

BuildMode

BuildMode: "SINGLE" | "MANY"

DelegationEvent

DelegationEvent<D, E, R>: E & { currentTarget: R; delegator: D }

A delegation event. The inferred event instance type with an additional property delegator referencing the descendant element that matched the delegation selector.

Type parameters

  • D: Element

    The element type for the delegation selector

  • E: Event

    The event instance type

  • R: Element

    The type of the root element (or event.currentTarget)

DelegationListener

DelegationListener<D, E, R>: (this: D, event: DelegationEvent<D, E, R>) => void

The listener callback to invoke whenever an event occurs. It is provided 2 ways to get the delegating element -- the 'delegator':

  • Through this binding
  • Through the property {@link DelegationEvent.delegator delegator} on the event argument.

Type parameters

  • D: Element

    The element type for the delegation selector

  • E: Event

    The event instance type

  • R: Element

    The type of the root element (or event.currentTarget)

Type declaration

EventMap

EventMap: GlobalEventHandlersEventMap

TagNameMap

TagNameMap: HTMLElementTagNameMap & SVGElementTagNameMap

Variables

Const default

default: AskRoot