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

1.0.0 • Public • Published

@ionaru/typed-events

npm version npm version Build Status

Description

A tiny package that provides a very simple event system with Typescript support.

Usage

npm install @ionaru/typed-events
import { TypedEvent } from '@ionaru/typed-events';

// Create a new event.
const myEvent = new TypedEvent<string>();

// Create a listener and subscribe to the event.
const listener = (message) => console.log(message);
myEvent.on(listener);

// Emit to notify all listeners.
myEvent.emit('Something happened!')

// console.log: 'Something happened!'

Readme

Keywords

none

Package Sidebar

Install

npm i @ionaru/typed-events

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

8.83 kB

Total Files

8

Last publish

Collaborators

  • ionaru