0.0.11 • Published 2 years ago

7pmlabs-event-bus v0.0.11

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

7pmlabs-event-bus

Lightweight native event bus in Typescipt.

Getting started

npm i 7pmlabs-event-bus

Usage

import { EventBus } from '7pmlabs-event-bus';

Event bus instance is signleton but you can give it a different name if you want to have more than one instance:

const eventBus = EventBus.getInstance();

Listen to a specific event:

eventBus.on('MY-CUSTOM-EVENT', (e) => {});

Listen only one time to a specific event:

eventBus.once('MY-CUSTOM-EVENT', (e) => {});

Emit an event:

eventBus.emit('MY-CUSTOM-EVENT', 'Hello world!');

Remove listener for a specific event:

eventBus.off('MY-CUSTOM-EVENT', (e) => {});
0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago