Skip to main content

triggerEvent

Callable

  • triggerEvent(el?: EventTarget, type: string, detail?: unknown): boolean

  • Small utility to trigger a custom event for a given EventTarget.


    Parameters

    • el: EventTarget = eventTarget

      The element or EventTarget to trigger the event upon

    • type: string

      The event type name

    • detail: unknown = null

      The event detail to be sent

    Returns boolean

    false if event is cancelable and at least one of the event handlers which received event called Event.preventDefault(). Otherwise it returns true.