Comparing version 3.1.3 to 3.1.4
@@ -1,4 +0,5 @@ | ||
import { Dispatch, SetStateAction } from 'react'; | ||
declare type GetState<S> = () => S; | ||
declare function useGetState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>, GetState<S>]; | ||
import type { Dispatch, SetStateAction } from 'react'; | ||
declare type GetStateAction<S> = () => S; | ||
declare function useGetState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>, GetStateAction<S>]; | ||
declare function useGetState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>, GetStateAction<S | undefined>]; | ||
export default useGetState; |
@@ -16,2 +16,3 @@ import { useRef } from 'react'; | ||
var onLongPressRef = useLatest(onLongPress); | ||
var onClickRef = useLatest(onClick); | ||
var timerRef = useRef(); | ||
@@ -42,4 +43,4 @@ var isTriggeredRef = useRef(false); | ||
if (shouldTriggerClick && !isTriggeredRef.current && onClick) { | ||
onClick(event); | ||
if (shouldTriggerClick && !isTriggeredRef.current && onClickRef.current) { | ||
onClickRef.current(event); | ||
} | ||
@@ -46,0 +47,0 @@ |
@@ -15,5 +15,4 @@ var cachePromise = new Map(); | ||
return res; | ||
})["catch"](function (err) { | ||
})["catch"](function () { | ||
cachePromise["delete"](cacheKey); | ||
throw err; | ||
}); | ||
@@ -20,0 +19,0 @@ }; |
@@ -1,4 +0,5 @@ | ||
import { Dispatch, SetStateAction } from 'react'; | ||
declare type GetState<S> = () => S; | ||
declare function useGetState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>, GetState<S>]; | ||
import type { Dispatch, SetStateAction } from 'react'; | ||
declare type GetStateAction<S> = () => S; | ||
declare function useGetState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>, GetStateAction<S>]; | ||
declare function useGetState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>, GetStateAction<S | undefined>]; | ||
export default useGetState; |
@@ -33,2 +33,3 @@ "use strict"; | ||
var onLongPressRef = useLatest_1["default"](onLongPress); | ||
var onClickRef = useLatest_1["default"](onClick); | ||
var timerRef = react_1.useRef(); | ||
@@ -59,4 +60,4 @@ var isTriggeredRef = react_1.useRef(false); | ||
if (shouldTriggerClick && !isTriggeredRef.current && onClick) { | ||
onClick(event); | ||
if (shouldTriggerClick && !isTriggeredRef.current && onClickRef.current) { | ||
onClickRef.current(event); | ||
} | ||
@@ -63,0 +64,0 @@ |
@@ -23,5 +23,4 @@ "use strict"; | ||
return res; | ||
})["catch"](function (err) { | ||
})["catch"](function () { | ||
cachePromise["delete"](cacheKey); | ||
throw err; | ||
}); | ||
@@ -28,0 +27,0 @@ }; |
{ | ||
"name": "ahooks", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"description": "react hooks library", | ||
@@ -62,3 +62,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"gitHead": "1a67662c37aa8a18d4c612d0516e328e0ff5fad4" | ||
"gitHead": "8b2436a1645d1ba93e327e0b5c0cebeefc692fb9" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
627160
15578