Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-debounce

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-debounce - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

7

CHANGELOG.md

@@ -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>;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc