
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
control-timeout
Advanced tools
#control-timeout
####A timeout class for controlling one or multiple timeouts.
###Features:
###Usage
First install: npm install --save control-timeout
// require the class
var Timeout= require( 'control-timeout' );
// you can change the timeout class default overall fallback delay time of 0 seconds
Timeout.delay= 10000; // milliseconds
// create a timeout instance/context and override the class default delay by
// passing a delay time that will be used as a fallback for all timeouts only in this instance
var timeout= new Timeout( 3000 );
// add a timeout to the context without running it right away
var first= timeout.add({
id : 'first'
// declare an action to be taken in case the timeout is reached
,action : () => console.log( 'first timeout has been triggered' )
});
// run it only when you need it
// this will start the timeout using the default context's 3000ms delay time
timeout.run( 'first' );
// first timeout has been triggered
// add a second timeout, this time overriding the default context delay
var second= timeout.add({
id : 'second'
// receive arguments passed by .run()
,action : ( msg1, msg2 ) => console.log( 'second timeout, message:', msg1+ msg2 )
// override the context default delay time for this specific timeout
,delay : 1000
});
// pass arguments to the timeout via the run method, after the id argument
timeout.run( 'second', 'hello arguments', '!')
// second timeout, message: hello arguments!
// calling run with a falsey first argument causes to start all timeouts in the context
timeout.run( null, 'generic', ' message..' );
// you can stop one or multiple timeouts from running
timeout.stop( 'first', 'second' );
// or you can stop all by not giving a specific name
timeout.stop();
// you can remove one or multiple timeouts from the context with remove
timeout.remove( 'first', 'second' );
// NOTE: removing timeouts also stops them if they are running
// or remove all registered timeouts at once
timeout.removeAll()
// you can also add a timeout like this
timeout.add( 'third', () => timeout.stop('first'), 2000 );
// you can change the delay of a specific timeout for it's following runs
timeout.setDelay( 'first', 1000 );
// you can change the default log method by passing a custom handler
Timeout.setLog( (err) => {
console.log( 'my custom input error handler', err );
});
// or turn logging of by calling setLog without arguments
Timeout.setLog();
The raw native setTimeout return value is only available after the .run mehtod has been called. So, if for some reason you need it, take run's return value:
// the run method returns the raw timeout
var rawSecond= timeout.run( 'second' );
// or all timeouts that are running, in an array
var timeouts= timeout.run();
// use getTimeout to get the raw timeout value of a running timeout
var rawFirst= timeout.getTimeout( 'first' );
###license
MIT
FAQs
A timeout class for controlling one or multiple timeouts
The npm package control-timeout receives a total of 12 weekly downloads. As such, control-timeout popularity was classified as not popular.
We found that control-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.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.