@rooks/use-mutation-observer
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -1,27 +0,3 @@ | ||
"use strict"; | ||
var _react = require("react"); | ||
var config = { | ||
attributes: true, | ||
characterData: true, | ||
subtree: true, | ||
childList: true | ||
}; | ||
module.exports = function (ref, callback) { | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : config; | ||
(0, _react.useEffect)(function () { | ||
// Create an observer instance linked to the callback function | ||
if (ref.current) { | ||
var observer = new MutationObserver(function (mutationList, observer) { | ||
callback(mutationList, observer); | ||
}); // Start observing the target node for configured mutations | ||
observer.observe(ref.current, options); | ||
return function () { | ||
observer.disconnect(); | ||
}; | ||
} | ||
}, [ref.current, callback, options]); | ||
}; | ||
"use strict";var _react=require("react"),config={attributes:!0,characterData:!0,subtree:!0,childList:!0};module.exports=function(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:config;(0,_react.useEffect)(function(){// Create an observer instance linked to the callback function | ||
if(a.current){var d=new MutationObserver(function(a,c){b(a,c)});// Start observing the target node for configured mutations | ||
return d.observe(a.current,c),function(){d.disconnect()}}},[a.current,b,c])}; |
@@ -27,3 +27,3 @@ { | ||
], | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"_id": "@rooks/use-mutation-observer@", | ||
@@ -37,3 +37,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "dfd1ff21eec3f6c8de8ed0b78d5abe7fa9a53662" | ||
"gitHead": "0c1030c6bd71ced54bb0ccd836372628b62e3f80" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47577
437