The MutationObserver method disconnect() tells the observer to stop watching for mutations.
The MutationObserver method observe() configures the MutationObserver callback to begin receiving notifications of changes to the DOM that match the given options.
Optionaloptions: MutationObserverInitThe MutationObserver method takeRecords() returns a list of all matching DOM changes that have been detected but not yet processed by the observer's callback function, leaving the mutation queue empty.
The
MutationObserverinterface provides the ability to watch for changes being made to the DOM tree.MDN Reference