@tamagui/use-event 1.125.19 → 1.125.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-event",
3
- "version": "1.125.19",
3
+ "version": "1.125.21",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -18,11 +18,11 @@
18
18
  "clean:build": "tamagui-build clean:build"
19
19
  },
20
20
  "devDependencies": {
21
- "@tamagui/build": "1.125.19",
21
+ "@tamagui/build": "1.125.21",
22
22
  "react": "*"
23
23
  },
24
24
  "dependencies": {
25
- "@tamagui/constants": "1.125.19"
25
+ "@tamagui/constants": "1.125.21"
26
26
  },
27
27
  "exports": {
28
28
  "./package.json": "./package.json",
@@ -1,11 +0,0 @@
1
- {
2
- "mappings": "AAAA,cAAc;AACd,cAAc",
3
- "names": [],
4
- "sources": [
5
- "src/index.ts"
6
- ],
7
- "sourcesContent": [
8
- "export * from './useEvent'\nexport * from './useGet'\n"
9
- ],
10
- "version": 3
11
- }
@@ -1,13 +0,0 @@
1
- {
2
- "mappings": "KAEK,eAAe,GAAG;AAEvB,OAAO,iBAAS,SAAS,UAAU,aAAaA,WAAW,IAAI",
3
- "names": [
4
- "callback?: T"
5
- ],
6
- "sources": [
7
- "src/useEvent.ts"
8
- ],
9
- "sourcesContent": [
10
- "import { useGet } from './useGet'\n\ntype AnyFunction = (...args: any[]) => any\n\nexport function useEvent<T extends AnyFunction>(callback?: T): T {\n return useGet(callback, defaultValue, true) as T\n}\n\nconst defaultValue = () => {\n throw new Error('Cannot call an event handler while rendering.')\n}\n"
11
- ],
12
- "version": 3
13
- }
@@ -1,15 +0,0 @@
1
- {
2
- "mappings": "AAKA,OAAO,iBAAS,OAAO,GACrBA,cAAc,GACdC,oBACAC,oCACO",
3
- "names": [
4
- "currentValue: A",
5
- "initialValue?: any",
6
- "forwardToFunction?: boolean"
7
- ],
8
- "sources": [
9
- "src/useGet.ts"
10
- ],
11
- "sourcesContent": [
12
- "import { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport * as React from 'react'\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 = React.useRef<any>(initialValue ?? currentValue)\n useIsomorphicLayoutEffect(() => {\n curRef.current = currentValue\n })\n\n return React.useCallback(\n forwardToFunction\n ? (...args) => curRef.current?.apply(null, args)\n : () => curRef.current,\n []\n )\n}\n"
13
- ],
14
- "version": 3
15
- }