@blinkk/degu
    Preparing search index...

    Function addDelegatedListener

    • Listens for a specified event on any element within the provided element and then recursively calls the listener on all ancestors of the originating element.

      For example a given module, when any click event happens within the module, call your listener repeatedly starting from the originating element and all of its ancestors (bubble up) up to the document root.

        dom.addDelegatedListener(
      myModuleElement || document.documentElement,
      'click',
      (e: HTMLElement, event: any) => {
      if (!e) {
      return;
      }
      // Called on the element that was clicked and it's parent
      // recursively until the document root.
      ...
      }
      );

      Parameters

      • el: HTMLElement

        Element to host the listener.

      • type: string

        Listener type.

      • listener: Function

        Listener function.

      Returns () => void