@3xpo/events

@3xpo/events

repo image

documentation npm codeberg
mit license mom made pizza mom made pizza
build hopefully succeeded

Installation

pnpm i @3xpo/events

Usage

import EventEmitter from '@3xpo/events';

const emitter = new EventEmitter<{
event1: (arg1: string, arg2: number) => void;
event2: (arg1: string) => void;
}>();

emitter.on('event1', (arg1, arg2) => {
console.log(arg1, arg2);
});

emitter.emit('event1', 'hello', 123);

Note

The EventEmitter is typesafe. If you want a non-typesafe eventemitter, either pass <any> or use NodeEventEmitter.

Note that typesafety is not available in pure JS.

Generated using TypeDoc