@3xpo/events
TypeScript icon, indicating that this package has built-in type declarations

1.0.17 • Public • Published

@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.

Readme

Keywords

none

Package Sidebar

Install

npm i @3xpo/events

Weekly Downloads

17

Version

1.0.17

License

MIT

Unpacked Size

44.2 kB

Total Files

14

Last publish

Collaborators

  • exponentialworkload