
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@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 {
// ...
}
// 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
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.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.