Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 28, 2024 via pnpm

throttle-debounce 2.3.0

Throttle and debounce functions.
Package summary
Share
0
issues
1
license
1
MIT
Package created
20 Dec 2014
Version published
12 Aug 2020
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
throttle-debounce@2.3.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
ⓘ This is a list of throttle-debounce 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does throttle-debounce do?

The "throttle-debounce" is a utility npm package aimed to help control the frequency of function execution. It offers throttle and debounce functions which are particularly useful for rate-limiting execution of handlers attached to events like resize and scroll. Being a version of "jquery-throttle-debounce", this module has been transferred to ES Modules and CommonJS format and does not depend on jQuery, making it more versatile and universal.

How do you use throttle-debounce?

Using the "throttle-debounce" is straightforward. First, make sure it is installed in your project by running npm install throttle-debounce --save in your terminal. There are two main functions you can import from 'throttle-debounce': throttle and debounce.

Here's an illustration of how to use throttle:

import { throttle } from 'throttle-debounce';

const throttleFunc = throttle(
    1000,
    (num) => {
        console.log('num:', num);
    }
);

throttleFunc(1); // Executes the callback

In this example, 'num: 1' is outputted to the console because callback executes immediately. However, if you call throttleFunc(2), it won't execute the callback immediately, but rather waiting for a 1000ms delay.

Here's an illustration of using debounce:

import { debounce } from 'throttle-debounce';

const debounceFunc = debounce(
    1000,
    (num) => {
        console.log('num:', num);
    }
);

debounceFunc(1); // Doesn’t execute the callback immediately.
debounceFunc(2); // The same, won’t execute the callback immediately.

In this example, both calls to debounceFunc() won't execute the callback immediately. Instead, they wait for a delay of 1000 ms, and call the function with the last received argument.

Where are the throttle-debounce docs?

Documentation for "throttle-debounce" is available on its GitHub page at https://github.com/niksy/throttle-debounce. This documentation provides a comprehensive overview of the API, usage examples, and additional details related to the module. This is an excellent resource for any developers looking to integrate "throttle-debounce" into their projects.