
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
@bscotch/emitter
Advanced tools
Existing EventEmitter libraries typically do not provide much support for indicating what events and payloads are available on a given emitter. This library adds that support to the popular EventEmitter2 library.
Events can be described as a string (when just the event name is needed because there is no expected payload) or as an object with a payload:
import {createEmitter} from '@bscotch/emitter';
type MySimpleEvent = "my-simple-event";
interface MyComplexEvent {
name: "my-complex-event";
// The payload must be a *tuple* of the arguments that will
// be passed to the event handler.
payload: [arg0: string, arg1: { foo: number }];
}
// For best results, events should be collected in a tuple type
type MyEvents = [MySimpleEvent, MyComplexEvent];
const emitter = createEmitter<MyEvents>();
// Now you'll have typed emitter methods!
emitter.on('my-simple-event', () => {});
emitter.emit('my-simple-event');
emitter.on('my-complex-event', (arg0, arg1) => {}); // <- callback is typed!
emitter.emit('my-complex-event', 'foo', { foo: 1 }); // <- arguments are typed!
FAQs
Extension of eventemitter2, adding typed events.
We found that @bscotch/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
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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.