json-dom
    Preparing search index...

    Function findEventListener

    • Search a DOM item's eventListeners for a specific event listener, matched by listener function, custom args, and whether it listens in the capture phase. Returns its index and the matching descriptor as a tuple.

      As with the DOM's removeEventListener, only the capture flag tells two listeners of the same function apart: once, passive and signal only change how a listener behaves, not which listener it is.

      item is the last parameter (instead of customArgs/options having literal defaults) so this can be curried and piped directly - see fullAddEventListener for an example of the pattern.

      Parameters

      • eventName: string

        The name of the trigger event the listener was registered under.

      • listenerFunction: string | ListenerFunction

        The listener function to match against.

      • customArgs: object | null | undefined

        The custom args the listener was registered with.

      • options: ListenerOptions | null | undefined

        The options the listener was registered with; only the capture flag is compared.

      • item: DomItem

        The DomItem whose eventListeners will be searched.

      Returns [number, ListenerDescriptor | undefined]

      A 2-element [index, matchingListener] tuple. If no match is found, index is -1 and matchingListener is undefined.