
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
async-debounce-jt
Advanced tools
Guard against calling an asynchronous method multiple times whilst the asynchronous operation is in progress.
Guard against calling an asynchronous function multiple times whilst the asynchronous operation is in progress. Once the operation is complete, the last call made to the function whilst the operation was in progress is made.
Intermediate calls are lost, if no calls are made whilst the asynchronous operation is in progress the function is not called again.
This debounce is not based on time, it's based on a callback which is made once the operation is completed.
npm install async-debounce
var debounce = require('async-debounce');
var guarded = debounce(function (args, callback) {
// do something with the arguments, then call the callback
});
guarded('hello', 'world'); // Parameters are combined in args parameter in the function
This example calls our method every 10th of a second, but it takes 1 second to complete. The result is the guarded method is only called 10 times.
var debounce = require('async-debounce');
var dostuff = debounce(function (args, callback) {
setTimeout(function () {
console.log('Called with: ', args[0]);
callback();
}, 1000);
});
var i = 0;
var interval = setInterval(function () {
dostuff(i);
i+=1;
}, 100);
setTimeout(function () {
clearInterval(interval);
}, 10000)
Called with: 0
Called with: 9
Called with: 20
Called with: 30
Called with: 40
Called with: 50
Called with: 60
Called with: 70
Called with: 80
Called with: 90
Called with: 98
FAQs
Guard against calling an asynchronous method multiple times whilst the asynchronous operation is in progress.
The npm package async-debounce-jt receives a total of 0 weekly downloads. As such, async-debounce-jt popularity was classified as not popular.
We found that async-debounce-jt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.