The tool allows userscript authors to wait or monitor for a change on a page.
Details
This library provides the following functions.
syncWithElement
The function syncWithElement is part of USERSCRIPT4C_SYNC allows to check for a HTML element on a page. When this element appears, the callback function is called.
Parameter
Description
targetElementSelector
Specify a jQuery selector to identify an element. This is the element the callback function is waiting for to appear on the page.
callbackFunction
A reference to the function to be called when the desired element appears on the page.
$observedRootElement
A jQuery reference to an element to observe for the selected element to appear in.
If undefined or empty, the body of the page is observed.
observerConfig
The configuration that is passed to the observer.
If undefined, the default configuration instructs the observer to listen to any changes on the observed root element.
The following code creates an observer waiting for an element with class myClass to apprear inside the referenced observed root element and the provided configuration for the observer..
The function monitorElement is part of USERSCRIPT4C_SYNC allows to continuously monitor a HTML element on a page for changes. On changes, the callback function is called.
Parameter
Description
callbackFunction
A reference to the function to be called when a change is registered on the page.
$observedRootElement
A jQuery reference to an element to monitor.
If undefined, the body of the page is observed.
observerConfig
The configuration that is passed to the observer.
If undefined, the default configuration instructs the observer to listen to any changes on the observed root element.