
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@rainder/co-event-emitter
Advanced tools
Subscribes for an event. CoEventEmitter allows to subscribe for an event only once. Throws an Error if there is already a listener for an event.
Examples:
//GeneratorFunction implementation
events.on('event-name', function *() {
return 'result';
});
//Async/Await implementation
events.on('event-name', async function () {
return 'result';
});
//Thunk implementation
events.on('event-name', (cb) => {
cb(null, 'result');
});
//Promise implementation
events.on('event-name', new Promise((resolve, reject) => {
resolve('result');
}));
//Promise v2 implementation
events.on('event-name', () => {
return Promise.resolve('result');
});
events.emit('event-name', 'hello world')
.then((result) => console.log(result)); //'hello world'
Removes a subscription for an event. Throws an error if no event listener found.
events.off('event-name');
Return true if there is a registered listener for a provided event.
events.has('event-name');
Emits an event and returns a promise. Throws an error if no event listener found.
events.call('event-name')
.then((result) => { /* handle result */ })
.catch((err) => { /* handle err */ });
}
Emits an event. Returns a boolean value indicating if listener have been found.
events.emit('event-name');
FAQs
co event emitter
We found that @rainder/co-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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.