Function fromDOMMutations

  • Creates a ReadableStream from DOM mutations.

    Parameters

    • target: Node
    • Optional options: MutationObserverInit
    • Optional queuingStrategy: QueuingStrategy<MutationRecord>

    Returns ReadableStream<MutationRecord>

    See

    Example

    fromDOMMutations(document.body, { childList: true })
    .pipeTo(write((mutation) => {
    console.info(mutation.addedNodes)
    }))

    If the queue is full when receiving DOM mutations, you may notice some events being dropped. To avoid this you will need to increase the high water mark.

    fromDOMMutations(
    document.body,
    { childList: true },
    new CountQueuingStrategy({ highWaterMark: 10 })
    )
    .pipeThrough(addedNodes())
    .pipeTo(
    write(console.info),
    new CountQueuingStrategy({ highWaterMark: 50 })
    )

Generated using TypeDoc