1 line
3.2 KiB
JSON
1 line
3.2 KiB
JSON
{"ast":null,"code":"import * as React from 'react';\n\n/**\n * Locker return cached mark.\n * If set to `true`, will return `true` in a short time even if set `false`.\n * If set to `false` and then set to `true`, will change to `true`.\n * And after time duration, it will back to `null` automatically.\n */\nexport default function useLock() {\n var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;\n var lockRef = React.useRef(null);\n var timeoutRef = React.useRef(null);\n\n // Clean up\n React.useEffect(function () {\n return function () {\n window.clearTimeout(timeoutRef.current);\n };\n }, []);\n function doLock(locked) {\n if (locked || lockRef.current === null) {\n lockRef.current = locked;\n }\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(function () {\n lockRef.current = null;\n }, duration);\n }\n return [function () {\n return lockRef.current;\n }, doLock];\n}","map":{"version":3,"names":["React","useLock","duration","arguments","length","undefined","lockRef","useRef","timeoutRef","useEffect","window","clearTimeout","current","doLock","locked","setTimeout"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-select/es/hooks/useLock.js"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Locker return cached mark.\n * If set to `true`, will return `true` in a short time even if set `false`.\n * If set to `false` and then set to `true`, will change to `true`.\n * And after time duration, it will back to `null` automatically.\n */\nexport default function useLock() {\n var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 250;\n var lockRef = React.useRef(null);\n var timeoutRef = React.useRef(null);\n\n // Clean up\n React.useEffect(function () {\n return function () {\n window.clearTimeout(timeoutRef.current);\n };\n }, []);\n function doLock(locked) {\n if (locked || lockRef.current === null) {\n lockRef.current = locked;\n }\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(function () {\n lockRef.current = null;\n }, duration);\n }\n return [function () {\n return lockRef.current;\n }, doLock];\n}"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,OAAOA,CAAA,EAAG;EAChC,IAAIC,QAAQ,GAAGC,SAAS,CAACC,MAAM,GAAG,CAAC,IAAID,SAAS,CAAC,CAAC,CAAC,KAAKE,SAAS,GAAGF,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG;EACtF,IAAIG,OAAO,GAAGN,KAAK,CAACO,MAAM,CAAC,IAAI,CAAC;EAChC,IAAIC,UAAU,GAAGR,KAAK,CAACO,MAAM,CAAC,IAAI,CAAC;;EAEnC;EACAP,KAAK,CAACS,SAAS,CAAC,YAAY;IAC1B,OAAO,YAAY;MACjBC,MAAM,CAACC,YAAY,CAACH,UAAU,CAACI,OAAO,CAAC;IACzC,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,SAASC,MAAMA,CAACC,MAAM,EAAE;IACtB,IAAIA,MAAM,IAAIR,OAAO,CAACM,OAAO,KAAK,IAAI,EAAE;MACtCN,OAAO,CAACM,OAAO,GAAGE,MAAM;IAC1B;IACAJ,MAAM,CAACC,YAAY,CAACH,UAAU,CAACI,OAAO,CAAC;IACvCJ,UAAU,CAACI,OAAO,GAAGF,MAAM,CAACK,UAAU,CAAC,YAAY;MACjDT,OAAO,CAACM,OAAO,GAAG,IAAI;IACxB,CAAC,EAAEV,QAAQ,CAAC;EACd;EACA,OAAO,CAAC,YAAY;IAClB,OAAOI,OAAO,CAACM,OAAO;EACxB,CAAC,EAAEC,MAAM,CAAC;AACZ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |