
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
delay-set-timeout
Advanced tools
Call setTimeout() with min/max delay.
npm install delay-set-timeout
var delay_set_timeout = require("delay-set-timeout");
var tmid = null; //timer-id
var ret = [];
//delay_set_timeout(callback / [eventEmitter, eventName], delay, tmidLast, maxDelay /*,arg1, arg2, ...*/)
tmid = delay_set_timeout( //get tmid at (start+0)
function () { ret.push(1); },
201, //plan at (start+201), but cancelled by 105.
tmid,
402 //final-time is (start+402)
);
setTimeout(
function () {
tmid = delay_set_timeout( //get new tmid at (start+105), cancel 201
function () {
ret.push(2); //run at (start+105+103)
},
//plan at (start+105+(N=103));
//here if (start+105+N) is larger than final-time, it will be shrinked to final-time.
103,
tmid, //old timer-id is required
404 //not work, (start+105+404)>(start+402), final-time is still (start+402)
);
},
105 //to cancel 201
);
setTimeout(
function () {
tmid = delay_set_timeout( //get new tmid at (start+308), a new timer, because (start+105+103) is finished
function () {
ret.push(3); //run at (start+308+106)
console.log(ret.join(","));
//ret.join(",") === "2,3"
},
106, //plan at (start+308+106)
tmid, //not work, the previous is finished
407 //new max-delay
);
},
308
);
FAQs
call setTimeout() with min/max delay
The npm package delay-set-timeout receives a total of 1 weekly downloads. As such, delay-set-timeout popularity was classified as not popular.
We found that delay-set-timeout 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.