1 line
3.7 KiB
JSON
1 line
3.7 KiB
JSON
|
{"ast":null,"code":"import canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport * as React from 'react';\nvar defaultOptions = {\n subtree: true,\n childList: true,\n attributeFilter: ['style', 'class']\n};\nexport default function useMutateObserver(nodeOrList, callback) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultOptions;\n React.useEffect(function () {\n if (!canUseDom() || !nodeOrList) {\n return;\n }\n var instance;\n var nodeList = Array.isArray(nodeOrList) ? nodeOrList : [nodeOrList];\n if ('MutationObserver' in window) {\n instance = new MutationObserver(callback);\n nodeList.forEach(function (element) {\n instance.observe(element, options);\n });\n }\n return function () {\n var _instance, _instance2;\n (_instance = instance) === null || _instance === void 0 ? void 0 : _instance.takeRecords();\n (_instance2 = instance) === null || _instance2 === void 0 ? void 0 : _instance2.disconnect();\n };\n }, [options, nodeOrList]);\n}","map":{"version":3,"names":["canUseDom","React","defaultOptions","subtree","childList","attributeFilter","useMutateObserver","nodeOrList","callback","options","arguments","length","undefined","useEffect","instance","nodeList","Array","isArray","window","MutationObserver","forEach","element","observe","_instance","_instance2","takeRecords","disconnect"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@rc-component/mutate-observer/es/useMutateObserver.js"],"sourcesContent":["import canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport * as React from 'react';\nvar defaultOptions = {\n subtree: true,\n childList: true,\n attributeFilter: ['style', 'class']\n};\nexport default function useMutateObserver(nodeOrList, callback) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultOptions;\n React.useEffect(function () {\n if (!canUseDom() || !nodeOrList) {\n return;\n }\n var instance;\n var nodeList = Array.isArray(nodeOrList) ? nodeOrList : [nodeOrList];\n if ('MutationObserver' in window) {\n instance = new MutationObserver(callback);\n nodeList.forEach(function (element) {\n instance.observe(element, options);\n });\n }\n return function () {\n var _instance, _instance2;\n (_instance = instance) === null || _instance === void 0 ? void 0 : _instance.takeRecords();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