json-dom
    Preparing search index...

    Function fullAddEventListener

    • Register the listener function, attach it as a descriptor on the item, then bind it onto the real element - the full setup sequence for a single event listener, in order:

      1. registerListener - store the real function in the root DomItem's eventActions, keyed by name.
      2. addEventListener - push an EventListener descriptor referencing that name onto item.eventListeners.
      3. bindListeners - activate and apply any unbound descriptors, attaching them to item.element.

      item is the last parameter (instead of name/customArgs/options having literal defaults) so addEventListener can be curried directly into the pipe below without an argument-reordering wrapper.

      Parameters

      • eventName: string

        The name of the trigger event (e.g. 'click').

      • listener: ListenerFunction

        The function to be called when the event is triggered.

      • name: string | null | undefined

        The name the listener will be registered under in eventActions.

      • customArgs: object | null | undefined

        Additional args passed through to the listener when called.

      • options: ListenerOptions | null | undefined

        Options to be used when the listener is attached to the element.

      • item: DomItem

        The DomItem which will receive the event listener.

      Returns DomItem