Function addEventListenerTo

Adds an event listener for the given event name to the given target.

Like EventTarget:addEventListener but it handles options object in case the browser does not support those. Does not support the signal option unless browser natively supports that.

  • Parameters

    • target: EventTarget
    • eventType: string
    • handler: EventListenerOrEventListenerObject
    • options: boolean | AddEventListenerOptions = {}

    Returns boolean

    true if successfully added, or false if the same handler has already been added by us, or if the handler is not a valid event listener.