Function watchForNode

  • Create a mutation observer that watches for a node matching a condition.

    Parameters

    • condition: ((node) => boolean)

      a function that returns true if the node matches

        • (node): boolean
        • Parameters

          • node: Node

          Returns boolean

    • callback: ((element) => void)

      a function to call when the node is added

        • (element): void
        • Parameters

          • element: Node

          Returns void

    • ancestor: Node = document.body

      the ancestor element to watch

    • observerOptions: MutationObserverInit = ...

      options to pass to the MutationObserver

    Returns MutationObserver

    a MutationObserver

Generated using TypeDoc