@tamagui/use-event 1.0.1-beta.138 → 1.0.1-beta.141
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/cjs/index.js +0 -0
- package/dist/cjs/index.js.map +0 -0
- package/dist/cjs/useEvent.js +0 -0
- package/dist/cjs/useEvent.js.map +0 -0
- package/dist/cjs/useGet.js +0 -0
- package/dist/cjs/useGet.js.map +0 -0
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +0 -0
- package/dist/esm/useEvent.js +0 -0
- package/dist/esm/useEvent.js.map +0 -0
- package/dist/esm/useGet.js +0 -0
- package/dist/esm/useGet.js.map +0 -0
- package/dist/jsx/index.js +0 -0
- package/dist/jsx/index.js.map +0 -0
- package/dist/jsx/useEvent.js +0 -0
- package/dist/jsx/useEvent.js.map +0 -0
- package/dist/jsx/useGet.js +2 -5
- package/dist/jsx/useGet.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
File without changes
|
package/dist/cjs/index.js.map
CHANGED
|
File without changes
|
package/dist/cjs/useEvent.js
CHANGED
|
File without changes
|
package/dist/cjs/useEvent.js.map
CHANGED
|
File without changes
|
package/dist/cjs/useGet.js
CHANGED
|
File without changes
|
package/dist/cjs/useGet.js.map
CHANGED
|
File without changes
|
package/dist/esm/index.js
CHANGED
|
File without changes
|
package/dist/esm/index.js.map
CHANGED
|
File without changes
|
package/dist/esm/useEvent.js
CHANGED
|
File without changes
|
package/dist/esm/useEvent.js.map
CHANGED
|
File without changes
|
package/dist/esm/useGet.js
CHANGED
|
File without changes
|
package/dist/esm/useGet.js.map
CHANGED
|
File without changes
|
package/dist/jsx/index.js
CHANGED
|
File without changes
|
package/dist/jsx/index.js.map
CHANGED
|
File without changes
|
package/dist/jsx/useEvent.js
CHANGED
|
File without changes
|
package/dist/jsx/useEvent.js.map
CHANGED
|
File without changes
|
package/dist/jsx/useGet.js
CHANGED
|
@@ -3,14 +3,11 @@ const isWeb = process.env.TAMAGUI_TARGET === "web";
|
|
|
3
3
|
const isClient = typeof window !== "undefined";
|
|
4
4
|
const useIsomorphicLayoutEffect = !isWeb || isClient ? useLayoutEffect : useEffect;
|
|
5
5
|
function useGet(currentValue, initialValue, forwardToFunction) {
|
|
6
|
-
const curRef = useRef(initialValue
|
|
6
|
+
const curRef = useRef(initialValue ?? currentValue);
|
|
7
7
|
useIsomorphicLayoutEffect(() => {
|
|
8
8
|
curRef.current = currentValue;
|
|
9
9
|
});
|
|
10
|
-
return useCallback(forwardToFunction ? (...args) =>
|
|
11
|
-
var _a;
|
|
12
|
-
return (_a = curRef.current) == null ? void 0 : _a.apply(null, args);
|
|
13
|
-
} : () => curRef.current, []);
|
|
10
|
+
return useCallback(forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current, []);
|
|
14
11
|
}
|
|
15
12
|
export {
|
|
16
13
|
useGet
|
package/dist/jsx/useGet.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/useGet.ts"],
|
|
4
4
|
"sourcesContent": ["import { useCallback, useEffect, useLayoutEffect, useRef } from 'react'\n\nconst isWeb = process.env.TAMAGUI_TARGET === 'web'\nconst isClient = typeof window !== 'undefined'\nconst useIsomorphicLayoutEffect = !isWeb || isClient ? useLayoutEffect : useEffect\n\n// keeps a reference to the current value easily\n\nexport function useGet<A>(\n currentValue: A,\n initialValue?: any,\n forwardToFunction?: boolean\n): () => A {\n const curRef = useRef<any>(initialValue ?? currentValue)\n useIsomorphicLayoutEffect(() => {\n curRef.current = currentValue\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback(\n forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,\n []\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAEA,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,WAAW,OAAO,WAAW;AACnC,MAAM,4BAA4B,CAAC,SAAS,WAAW,kBAAkB;AAIlE,gBACL,cACA,cACA,mBACS;AACT,QAAM,SAAS,OAAY,
|
|
5
|
+
"mappings": "AAAA;AAEA,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,WAAW,OAAO,WAAW;AACnC,MAAM,4BAA4B,CAAC,SAAS,WAAW,kBAAkB;AAIlE,gBACL,cACA,cACA,mBACS;AACT,QAAM,SAAS,OAAY,gBAAgB,YAAY;AACvD,4BAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC;AAED,SAAO,YACL,oBAAoB,IAAI,SAAS,OAAO,SAAS,MAAM,MAAM,IAAI,IAAI,MAAM,OAAO,SAClF,CAAC,CACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-event",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.141",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"clean:build": "tamagui-build clean:build"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
22
|
+
"@tamagui/build": "^1.0.1-beta.141",
|
|
23
23
|
"react": "*"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|