@rooks/use-mutation-observer
Advanced tools
Comparing version 3.0.0-beta.3 to 3.0.0-beta.4
@@ -21,12 +21,11 @@ 'use strict'; | ||
*/ | ||
function useMutationObserver(ref, callback, options) { | ||
if (options === void 0) { options = config; } | ||
react.useEffect(function () { | ||
function useMutationObserver(ref, callback, options = config) { | ||
react.useEffect(() => { | ||
// Create an observer instance linked to the callback function | ||
if (ref.current) { | ||
var observer_1 = new MutationObserver(callback); | ||
const observer = new MutationObserver(callback); | ||
// Start observing the target node for configured mutations | ||
observer_1.observe(ref.current, options); | ||
return function () { | ||
observer_1.disconnect(); | ||
observer.observe(ref.current, options); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
@@ -33,0 +32,0 @@ } |
@@ -19,12 +19,11 @@ import { useEffect } from 'react'; | ||
*/ | ||
function useMutationObserver(ref, callback, options) { | ||
if (options === void 0) { options = config; } | ||
useEffect(function () { | ||
function useMutationObserver(ref, callback, options = config) { | ||
useEffect(() => { | ||
// Create an observer instance linked to the callback function | ||
if (ref.current) { | ||
var observer_1 = new MutationObserver(callback); | ||
const observer = new MutationObserver(callback); | ||
// Start observing the target node for configured mutations | ||
observer_1.observe(ref.current, options); | ||
return function () { | ||
observer_1.disconnect(); | ||
observer.observe(ref.current, options); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
@@ -31,0 +30,0 @@ } |
@@ -21,12 +21,11 @@ 'use strict'; | ||
*/ | ||
function useMutationObserver(ref, callback, options) { | ||
if (options === void 0) { options = config; } | ||
react.useEffect(function () { | ||
function useMutationObserver(ref, callback, options = config) { | ||
react.useEffect(() => { | ||
// Create an observer instance linked to the callback function | ||
if (ref.current) { | ||
var observer_1 = new MutationObserver(callback); | ||
const observer = new MutationObserver(callback); | ||
// Start observing the target node for configured mutations | ||
observer_1.observe(ref.current, options); | ||
return function () { | ||
observer_1.disconnect(); | ||
observer.observe(ref.current, options); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
@@ -33,0 +32,0 @@ } |
@@ -19,12 +19,11 @@ import { useEffect } from 'react'; | ||
*/ | ||
function useMutationObserver(ref, callback, options) { | ||
if (options === void 0) { options = config; } | ||
useEffect(function () { | ||
function useMutationObserver(ref, callback, options = config) { | ||
useEffect(() => { | ||
// Create an observer instance linked to the callback function | ||
if (ref.current) { | ||
var observer_1 = new MutationObserver(callback); | ||
const observer = new MutationObserver(callback); | ||
// Start observing the target node for configured mutations | ||
observer_1.observe(ref.current, options); | ||
return function () { | ||
observer_1.disconnect(); | ||
observer.observe(ref.current, options); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
@@ -31,0 +30,0 @@ } |
@@ -23,12 +23,11 @@ (function (global, factory) { | ||
*/ | ||
function useMutationObserver(ref, callback, options) { | ||
if (options === void 0) { options = config; } | ||
react.useEffect(function () { | ||
function useMutationObserver(ref, callback, options = config) { | ||
react.useEffect(() => { | ||
// Create an observer instance linked to the callback function | ||
if (ref.current) { | ||
var observer_1 = new MutationObserver(callback); | ||
const observer = new MutationObserver(callback); | ||
// Start observing the target node for configured mutations | ||
observer_1.observe(ref.current, options); | ||
return function () { | ||
observer_1.disconnect(); | ||
observer.observe(ref.current, options); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
@@ -35,0 +34,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).useMutationObserver=t(e.React)}(this,function(e){"use strict";var t={attributes:!0,characterData:!0,subtree:!0,childList:!0};return function(r,n,u){void 0===u&&(u=t),e.useEffect(function(){if(r.current){var e=new MutationObserver(n);return e.observe(r.current,u),function(){e.disconnect()}}},[r.current,n,u])}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).useMutationObserver=t(e.React)}(this,function(e){"use strict";var t={attributes:!0,characterData:!0,subtree:!0,childList:!0};return function(r,n,u=t){e.useEffect(()=>{if(r.current){const e=new MutationObserver(n);return e.observe(r.current,u),()=>{e.disconnect()}}},[r.current,n,u])}}); | ||
//# sourceMappingURL=index.min.js.map |
@@ -34,3 +34,3 @@ { | ||
], | ||
"version": "3.0.0-beta.3", | ||
"version": "3.0.0-beta.4", | ||
"_id": "@rooks/use-mutation-observer@", | ||
@@ -44,3 +44,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "0469063d73207867117f0ae67c4d5a3f88f0ed7b" | ||
"gitHead": "380c23550a5c5ac1b147986ec2c6e3b6077e9c57" | ||
} |
{ | ||
"extends": "../tsconfig.settings.json", | ||
"compilerOptions": { | ||
"rootDir": "../../", | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"types": ["../../node_modules/shared/useMutationObserver"] | ||
"baseUrl": "../../", | ||
"declarationDir": "lib", | ||
"paths": { | ||
"shared/*": ["../shared/*"] | ||
} | ||
}, | ||
"include": ["node_modules/shared/*.ts"], | ||
"references": [ | ||
@@ -9,0 +14,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
67
627
59531