
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.
@dekkai/event-emitter
Advanced tools
An event emitter base class that supports omni-listeners. Supports browsers, node and deno.
An event emitter class, supports omni-listeners and symbol events. Tested on browsers, node.js and deno.
Check out the full API Documentation
Browser/NodeJS
$ yarn add @dekkai/event-emitter
Deno
// import from directly from a CDN, like unpkg.com
import {EventEmitter} from 'https://unpkg.com/@dekkai/event-emitter';
// import EventEmitter
import {EventEmitter} from '@dekkai/event-emitter';
// can be extended
class MyEmitter extends EventEmitter {
// ...
}
// used as a mixin
const MyEmitter = EventEmitter.mixin(BaseClass);
// or injected in the inheritance chain
class MyEmitter extends EventEmitter.mixin(BaseClass) {
// ...
}
// instantiate the emitter
const emitter = new MyEmitter();
// create an event handler
const handler = (evt, num0, num1) => console.log(`Event [${evt.toString()}] result: ${num0 + num1}`);
// register the handler
emitter.on('add', handler);
// events can also be symbols
const symbolEvent = Symbol('add-symbol');
emitter.on(symbolEvent, handler);
// emit events
emitter.emit('add', 4, 6); // Event [add] result: 10
emitter.emit(symbolEvent, 12, 8); // Event [Symbol(add-symbol)] result: 20
// remove previously added listeners
emitter.off('add', handler);
emitter.off(symbolEvent, handler);
// use omni-listeners to catch all events, register them using the `omniEvent` static property
const omniHandler = evt => console.log(evt.toString());
emitter.on(MyEmitter.omniEvent, omniHandler);
// the omni-listener will catch all events
emitter.emit('hello'); // hello
emitter.emit(Symbol('random symbol')); // Symbol(random symbol)
// removing omni-listeners works the same way as with regular listeners, but using the `omniEvent`
emitter.off(MyEmitter.omniEvent, omniHandler);
Check out the full API Documentation
FAQs
An event emitter base class that supports omni-listeners. Supports browsers, node and deno.
We found that @dekkai/event-emitter 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
/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.