Function fromDOMEvent

  • Creates a readable stream from DOM events.

    Type Parameters

    • K extends keyof WindowEventMap

    Parameters

    • element: Window
    • type: K
    • Optional options: boolean | AddEventListenerOptions
    • Optional queuingStrategy: QueuingStrategy<WindowEventMap[K]>

    Returns ReadableStream<WindowEventMap[K]>

    Example

    fromDOMEvent(window, 'resize')
    fromDOMEvent(document, 'click', { capture: true })

    If you're receiving an excessive amount of events and find that some are being dropped, you may wish to increase the high water mark.

    fromDOMEvent(
    document.body,
    'mousemove',
    {},
    new CountQueuingStrategy({ highWaterMark: 100 })
    )
  • Type Parameters

    • K extends keyof DocumentEventMap

    Parameters

    • element: Document
    • type: K
    • Optional options: boolean | AddEventListenerOptions
    • Optional queuingStrategy: QueuingStrategy<DocumentEventMap[K]>

    Returns ReadableStream<DocumentEventMap[K]>

  • Type Parameters

    • K extends keyof HTMLElementEventMap

    Parameters

    • element: HTMLElement
    • type: K
    • Optional options: boolean | AddEventListenerOptions
    • Optional queuingStrategy: QueuingStrategy<HTMLElementEventMap[K]>

    Returns ReadableStream<HTMLElementEventMap[K]>

  • Parameters

    • element: Document | HTMLElement | Window
    • type: string
    • Optional options: boolean | AddEventListenerOptions
    • Optional queuingStrategy: QueuingStrategy<Event>

    Returns ReadableStream<Event>

Generated using TypeDoc