use-debounce
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -0,1 +1,5 @@ | ||
## 6.0.1 | ||
- Fixed `useDebouncedCallback` return type. Closed https://github.com/xnimorz/use-debounce/issues/103 thanks to [@VanTanev](https://github.com/VanTanev) | ||
## 6.0.0 | ||
@@ -42,6 +46,5 @@ | ||
```js | ||
const { callback, isPending } = useDebouncedCallback(/*...*/); | ||
const { isPending } = useDebouncedCallback(/*...*/); | ||
/** | ||
* { | ||
* callback: (...args: any[]) => ReturnType<T> | ||
* cancel: () => void | ||
@@ -48,0 +51,0 @@ * flush: () => void |
@@ -18,3 +18,3 @@ export interface CallOptions { | ||
export interface DebouncedState<T extends (...args: any[]) => ReturnType<T>> extends ControlFunctions { | ||
(...args: Parameters<T>): ReturnType<T>; | ||
(...args: Parameters<T>): ReturnType<T> | undefined; | ||
} | ||
@@ -21,0 +21,0 @@ /** |
@@ -18,3 +18,3 @@ export interface CallOptions { | ||
export interface DebouncedState<T extends (...args: any[]) => ReturnType<T>> extends ControlFunctions { | ||
(...args: Parameters<T>): ReturnType<T>; | ||
(...args: Parameters<T>): ReturnType<T> | undefined; | ||
} | ||
@@ -21,0 +21,0 @@ /** |
{ | ||
"name": "use-debounce", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Debounce hook for react", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -246,5 +246,5 @@ <div align="center"> | ||
#### Pending method | ||
#### isPending method | ||
`pending` method shows whether component has pending callbacks. Works for both `useDebounce` and `useDebouncedCallback`: | ||
`isPending` method shows whether component has pending callbacks. Works for both `useDebounce` and `useDebouncedCallback`: | ||
@@ -255,7 +255,7 @@ ```javascript | ||
expect(debounced.pending()).toBeFalsy(); | ||
expect(debounced.isPending()).toBeFalsy(); | ||
debounced(); | ||
expect(debounced.pending()).toBeTruthy(); | ||
expect(debounced.isPending()).toBeTruthy(); | ||
debounced.flush(); | ||
expect(debounced.pending()).toBeFalsy(); | ||
expect(debounced.isPending()).toBeFalsy(); | ||
@@ -262,0 +262,0 @@ return <span>{text}</span>; |
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
69105