mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
24 lines
535 B
JavaScript
24 lines
535 B
JavaScript
/* Safe MutationObserver, does nothing if MutationObserver is not supported.
|
|
*
|
|
* ```javascript
|
|
* var observer = new DomObserver(function (mutations)
|
|
* {
|
|
* // Do something.
|
|
* });
|
|
* observer.observe(document.htmlElement);
|
|
* observer.disconnect();
|
|
* ```
|
|
*/
|
|
|
|
exports = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
|
|
|
if (!exports)
|
|
{
|
|
exports = class MutationObserver {
|
|
constructor() {}
|
|
observe() {}
|
|
disconnect() {}
|
|
takeRecords() {}
|
|
};
|
|
}
|