Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
promise-timers
Advanced tools
A promised library of timers for Node.js and the browser. If you know the WindowTimers and promises you know how to use PromiseTimers.
npm install promise-timers
PromiseTimers.setTimeout
delay
The number of milliseconds to wait before calling resolve....args
Optional arguments to pass when the resolve is executed.PromiseTimers.setInterval
delay
The number of milliseconds to wait before calling resolve.method
A function that repeats on each interval. This function will fire upon each interval unless one of the following returns are implemented.
result
Any valid JavaScript error type. Will fire the reject and pass the error.result
A boolean that calls resolve if true or reject if false.result
Any thing returned besides null
, undefined
, false
, and a valid Error
type will resolve with that return value as the first argument.result
<Null, Undefined> Both are ignored and will not trigger the resolve or reject....args
Optional arguments to pass when the resolve is executed.PromiseTimers.setImmediate
...args
Optional arguments to pass when the resolve is executed.PromiseTimers.clearTimeout
timeout
A Timeout object as returned by setInterval().PromiseTimers.clearInterval
interval
A Interval object as returned by setInterval().PromiseTimers.clearImmediate
immediate
An Immediate object as returned by setImmediate().const PromiseTimers = require('promise-timers');
const delay = 500;
PromiseTimers.setTimeout(delay).then(function (args) {
// this refers to timeout
console.log(args);
console.log('timeout done');
});
var i = 0;
function method () {
// this refers to interval
if (i > 5) {
return true;
} else {
console.log(i);
i++;
}
};
PromiseTimers.setInterval(delay, method).then(function (args) {
// this refers to interval
console.log(args);
console.log('interval done');
});
PromiseTimers.setImmediate().then(function (args) {
// this refers to immediate
console.log(args);
console.log('immediate done');
});
FAQs
Promise Timers
We found that promise-timers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.