use-next-tick 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-native.js +2 -2
- package/dist/react-native.js.map +3 -3
- package/package.json +3 -3
package/dist/react-native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useEffect as i,useRef as r,useCallback as
|
|
1
|
+
import{useEffect as i,useRef as r,useCallback as o}from"react";function u(){let e=r([]),t=r(!1);return i(()=>{if(!t.current)return;t.current=!1;let c=e.current;e.current=[],setTimeout(()=>{for(let n of c)n()},0)}),o((c)=>{e.current.push(c),t.current=!0},[])}export{u as default};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=3B7FF0A1E8F2680564756E2164756E21
|
|
4
4
|
//# sourceMappingURL=react-native.js.map
|
package/dist/react-native.js.map
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/react-native.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { useEffect, useRef, useCallback } from \"react\";\n\nexport type NextTickCallback = () => void | Promise<void>;\n\nexport default function useNextTick(): (cb: NextTickCallback) => void {\n const callbacksRef = useRef<NextTickCallback[]>([]);\n const pendingRef = useRef(false);\n\n useEffect(() => {\n if (!pendingRef.current) return;\n\n pendingRef.current = false;\n const pending = callbacksRef.current;\n callbacksRef.current = [];\n
|
|
5
|
+
"import { useEffect, useRef, useCallback } from \"react\";\n\nexport type NextTickCallback = () => void | Promise<void>;\n\nexport default function useNextTick(): (cb: NextTickCallback) => void {\n const callbacksRef = useRef<NextTickCallback[]>([]);\n const pendingRef = useRef(false);\n\n useEffect(() => {\n if (!pendingRef.current) return;\n\n pendingRef.current = false;\n const pending = callbacksRef.current;\n callbacksRef.current = [];\n setTimeout(() => {\n for (const cb of pending) {\n cb();\n }\n }, 0);\n });\n\n const nextTick = useCallback((cb: NextTickCallback) => {\n callbacksRef.current.push(cb);\n pendingRef.current = true;\n }, []);\n\n return nextTick;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "AAAA,oBAAS,YAAW,iBAAQ,cAI5B,SAAwB,CAAW,EAAmC,CACpE,IAAM,EAAe,EAA2B,CAAC,CAAC,EAC5C,EAAa,EAAO,EAAK,EAoB/B,OAlBA,EAAU,IAAM,CACd,GAAI,CAAC,EAAW,QAAS,OAEzB,EAAW,QAAU,GACrB,IAAM,EAAU,EAAa,QAC7B,EAAa,QAAU,CAAC,EACxB,
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": "AAAA,oBAAS,YAAW,iBAAQ,cAI5B,SAAwB,CAAW,EAAmC,CACpE,IAAM,EAAe,EAA2B,CAAC,CAAC,EAC5C,EAAa,EAAO,EAAK,EAoB/B,OAlBA,EAAU,IAAM,CACd,GAAI,CAAC,EAAW,QAAS,OAEzB,EAAW,QAAU,GACrB,IAAM,EAAU,EAAa,QAC7B,EAAa,QAAU,CAAC,EACxB,WAAW,IAAM,CACf,QAAW,KAAM,EACf,EAAG,GAEJ,CAAC,EACL,EAEgB,EAAY,CAAC,IAAyB,CACrD,EAAa,QAAQ,KAAK,CAAE,EAC5B,EAAW,QAAU,IACpB,CAAC,CAAC",
|
|
8
|
+
"debugId": "3B7FF0A1E8F2680564756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-next-tick",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A React hook for running callbacks after the DOM or native views have updated.",
|
|
5
5
|
"repository": "suhaotian/use-next-tick",
|
|
6
6
|
"bugs": "https://github.com/suhaotian/use-next-tick/issues",
|
|
7
7
|
"homepage": "https://suhaotian.github.io/use-next-tick",
|
|
8
|
+
"react-native": "./dist/react-native.js",
|
|
8
9
|
"main": "./dist/index.js",
|
|
9
10
|
"module": "./dist/index.js",
|
|
10
|
-
"react-native": "./dist/react-native.js",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"import": "./dist/index.js",
|
|
15
14
|
"react-native": "./dist/react-native.js",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts"
|
|
17
17
|
}
|
|
18
18
|
},
|