
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@wetransfer/concorde-timer
Advanced tools
Useful functions to deal with timing in JavaScript.
Useful functions to deal with timing in JavaScript.
npm install @wetransfer/concorde-timer --save
Import the package if your are using a package bundler like Webpack or Parcel:
import Timer from '@wetransfer/concorde-timer';
const timedFunction = () => {
console.log('ping!')
}
const stopwatch = new Timer(10000, timedFunction);
// => Timer {remaining: 10000, callback: ƒ, paused: false, delay: 10, time: 1523436642013}
// (T+5 seconds)
stopwatch
// => Timer {remaining: 5000, callback: ƒ, paused: false, delay: 10, time: 1523436647000}
// (T+10 seconds)
// 'ping!'
Or load directly the final bundle on your browser, using a script tag. All concorde.js modules will be available in a global variable called WT
:
<!-- This will load the latest version of @wetransfer/concorde-timer module -->
<script src="https://unpkg.com/@wetransfer/concorde-timer/dist/concorde-timer.min.js"></script>
<script>
function timedFunction() {
console.log('ping!')
}
var stopwatch = new WT.timer(10000, timedFunction);
// => Timer {remaining: 10000, callback: ƒ, paused: false, delay: 10, time: 1523436642013}
// (T+5 seconds)
stopwatch
// => Timer {remaining: 5000, callback: ƒ, paused: false, delay: 10, time: 1523436647000}
// (T+10 seconds)
// 'ping!'
</script>
const Timer = require('@wetransfer/concorde-timer');
const timedFunction = () => {
console.log('ping!')
}
const stopwatch = new Timer(10000, timedFunction);
// => Timer {remaining: 10000, callback: ƒ, paused: false, delay: 10, time: 1523436642013}
// (T+5 seconds)
stopwatch
// => Timer {remaining: 5000, callback: ƒ, paused: false, delay: 10, time: 1523436647000}
// (T+10 seconds)
// 'ping!'
In order to be able to use the Timer
module, you must create an instance of it providing the time and the callback function. The time is provided in milliseconds. The actual delay may be longer than intended; JavaScript timing is notoriously bad.
// (T)
function timedFunction() {
console.log('ping!')
}
const stopwatch = new Timer(10000, timedFunction);
// => Timer {remaining: 10000, callback: ƒ, paused: false, delay: 10, time: 1523436642013}
// (T+5 seconds)
console.log(stopwatch)
// => Timer {remaining: 5000, callback: ƒ, paused: false, delay: 10, time: 1523436647000}
// (T+10 seconds)
// 'ping!'
timer.pause
Pauses the current Timer. The callback will not be executed unless the Timer is resumed.
// (T)
function timedFunction() {
console.log('ping!');
}
const stopwatch = new Timer(10000, timedFunction);
// (T+2 seconds)
stopwatch.pause();
// (T+10 seconds)
stopwatch.resume(); // see Timer.resume() method
// (T+18 seconds)
// 'ping!'
timer.resume
Resumes the current Timer.
// (T)
function timedFunction() {
console.log('ping!');
}
const stopwatch = new Timer(10000, timedFunction);
// (T+2 seconds)
stopwatch.pause(); // see Timer.pause
// (T+10 seconds)
stopwatch.resume();
// (T+18 seconds)
// 'ping!'
timer.stop
Stops and clears the current Timer.
// (T)
function timedFunction() {
console.log('ping!');
}
const stopwatch = new Timer(10000, timedFunction);
// (T+2 seconds)
stopwatch.stop();
// (T+X seconds)
// Don't expect anything to happen
timer.reset
Resets the current Timer, aka, stop, restore the remaining time and start again.
// (T)
function timedFunction() {
console.log('ping!');
}
const stopwatch = new Timer(10000, timedFunction);
// (T+2 seconds)
stopwatch.reset();
// (T+12 seconds)
// 'peng!'
In case you want to develop/debug this module while integrating with other project, please follow these steps:
npm link
to create a global symlink to that modulenpm run build:watch
to listen to changes and rebuild the modulenpm link @wetransfer/concorde-timer
FAQs
Useful functions to deal with timing in JavaScript.
The npm package @wetransfer/concorde-timer receives a total of 0 weekly downloads. As such, @wetransfer/concorde-timer popularity was classified as not popular.
We found that @wetransfer/concorde-timer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.