• Creates a function to be called with listener functions to return `apply

    @example import { listener } from 'deleight/dom/components' import { apply } from 'deleight/dom/apply'

    document.body.innerHTML = `

    I am a div

    I am a paragraph

    I am a section
    I am an article
    `;

    const componentFactory = listener('click', { once: true })

    const btns = []; const component = componentFactory(e => btns.push(e.target.textContent));

    const subComponents = { button: component } apply({ section: subComponents, article: subComponents });

    Parameters

    • event: keyof HTMLElementEventMap
    • Optional options: AddEventListenerOptions

    Returns ((listener) => ((elements) => void))

      • (listener): ((elements) => void)
      • Parameters

        • listener: EventListener

        Returns ((elements) => void)

          • (elements): void
          • Parameters

            • elements: Element | Iterable<Element>

            Returns void