
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@botdev-univ/events
Advanced tools
A simple and lightweight EventEmitter for node.js or browsers.
A simple and lightweight EventEmitter library for node.js or browsers.
Install the dependency
npm install @botdev-univ/events
yarn add @botdev-univ/events
It's a class for managing events. It can be extended to provide event functionality for other classes or object.
There have two ways to use it.
One way:
import EventEmitter from '@botdev-univ/events';
const emitter = new EventEmitter();
emitter.on('event', evt => {
console.log(evt);
});
Another way:
class Store extends EventEmitter {
set(key: string, value: any) {
this.emit(`change:${key}`, value);
}
}
Listen on a new event by type and handler. If listen on, the true is returned, otherwise the false. The handler will not be listen if it is a duplicate.
string
) - event type, it must be a unique string.boolean
) If listen on, the true is returned, otherwise the false.const emitter = new EventEmitter();
emitter.on('event', evt => {
console.log(evt);
});
Listen on an once event by type and handler. When the event is fired, that will be listen off immediately and automatically. The handler will not be listen if it is a duplicate.
string
) - event type, it must be a unique string.boolean
) If listened on, the true is returned, otherwise the false.const emitter = new EventEmitter();
emitter.once('event', evt => {
console.log(evt);
});
Listen off an event by type and handler. Or listen off events by type, when if only type argument is passed. Or listen off all events, when if no arguments are passed.
string
optional
) event typeoptional
) event handlerListen off the specified event.
const emitter = new EventEmitter();
emitter.off('event', evt => undefined);
Listen off events by type.
const emitter = new EventEmitter();
emitter.off('event');
Listen off all events, it does samething as offAll
method.
const emitter = new EventEmitter();
emitter.off();
Emit the specified event, and you can to pass a data. When emitted, every handler attached to that event will be executed. But, if it's an once event, listen off it immediately after called handler.
string
) - event typeany
) - event dataconst emitter = new EventEmitter();
emitter.emit('event', 'test data');
The event handler, that is a normal function.
Event object.
string
) - event typeany
) - event datanumber
) - the timestamp when event emittedboolean
) - it is an once event, that meaning listen off after event firedFAQs
A simple and lightweight EventEmitter for node.js or browsers.
The npm package @botdev-univ/events receives a total of 0 weekly downloads. As such, @botdev-univ/events popularity was classified as not popular.
We found that @botdev-univ/events 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.