
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
async-debounce
Advanced tools
Debounce asynchronous functions.
Debouncing means that given function is only run after no calls to it have happened for x milliseconds. With functions that do asynchronous work, i.e. not finish in the same tick, you also want no calls to happen while the function is currently running - limit the concurrency to one - and rerun with new arguments afterwards.
var debounce = require('async-debounce');
function async(num, done) {
console.log('start', num);
setTimeout(function() {
console.log('done', num);
done();
}, 200);
}
var debounced = debounce(async, 50);
console.log('call 1'); debounced(1);
setTimeout(function() { console.log('call 2'); debounced(2) }, 100);
setTimeout(function() { console.log('call 3'); debounced(3) }, 200);
And in the output you can see that the function is run at max once at a time and if the debounce triggers while the function is still running, it will be queued.
$ node example.js
call 1
start 1
call 2
call 3
done 1
start 3
done 3
Install with npm:
$ npm install async-debounce
Install with component(1):
$ component install juliangruber/async-debounce
Returns a decorated version of fn that when called calls fn only when no further calls have happended for interval milliseconds and if it's not currently running. When it's done running and a call has happened while it was still running, it's called again with latest arguments.
MIT
FAQs
Debounce asynchronous functions
The npm package async-debounce receives a total of 14 weekly downloads. As such, async-debounce popularity was classified as not popular.
We found that async-debounce 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.