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

use-debounce

Package Overview
Dependencies
Maintainers
0
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-debounce - npm Package Versions

1
8

7.0.0

Diff

Changelog

Source

7.0.0

  • breaking change useDebounce hook changed isPending behavior from async reacting to the sync. Now isPending returns True as soon as the new value is sent to the hook.
  • Dev dependencies updated
xnimorz
published 6.0.1 •

Changelog

Source

6.0.1

  • Fixed useDebouncedCallback return type. Closed https://github.com/xnimorz/use-debounce/issues/103 thanks to @VanTanev
xnimorz
published 6.0.0 •

Changelog

Source

6.0.0

  • breaking change: removed callback field, instead of this useDebouncedCallback and useThrottledCallback returns a callable function: Old:

    const { callback, pending } = useDebouncedCallback(/*...*/);
    // ...
    debounced.callback();
    

    New:

    const debounced = useDebouncedCallback(/*...*/);
    // ...
    debounced();
    /**
     * Also debounced has fields:
     * {
     *   cancel: () => void
     *   flush: () => void
     *   isPending: () => boolean
     * }
     * So you can call debounced.cancel(), debounced.flush(), debounced.isPending()
     */
    

    It makes easier to understand which cancel \ flush or isPending is called in case you have several debounced functions in your component

  • breaking change: Now useDebounce, useDebouncedCallback and useThrottledCallback has isPending method instead of pending

    Old:

    const { callback, pending } = useDebouncedCallback(/*...*/);
    

    New:

    const { isPending } = useDebouncedCallback(/*...*/);
    /**
     * {
     *   cancel: () => void
     *   flush: () => void
     *   isPending: () => boolean
     * }
     */
    
  • get rid of useCallback calls

  • improve internal typing

  • decrease the amount of functions to initialize each useDebouncedCallback call

  • reduce library size:

    Whole library: from 946 B to 899 B === 47 B useDebounce: from 844 to 791 === 53 B useDebouncedCallback: from 680 to 623 === 57 B useThrottledCallback: from 736 to 680 === 56 B

xnimorz
published 6.0.0-beta •

xnimorz
published 5.2.1 •

Changelog

Source

5.2.1

  • prevent having ininite setTimeout setup when component gets unmounted https://github.com/xnimorz/use-debounce/issues/97
  • function type works correctly with useDebounce now. https://github.com/xnimorz/use-debounce/pull/95 Thanks to @csu-feizao
xnimorz
published 5.2.0-beta •

xnimorz
published 5.2.0 •

Changelog

Source

5.2.0

  • Added useThrottledCallback
xnimorz
published 5.1.0 •

Changelog

Source

5.1.0

wait param is optional. If you don't provide a wait argument, use-debounce will postpone a callback with requestAnimationFrame if it's in browser environment, or through setTimeout(..., 0) otherwise.

xnimorz
published 5.0.4 •

Changelog

Source

5.0.4

  • Add an export for React Native
xnimorz
published 5.0.3 •

Changelog

Source

5.0.3

  • Fix the export map (https://github.com/xnimorz/use-debounce/issues/84);
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