1.0.3 • Published 1 year ago

my-custom-event-emitter v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Custom Event Emitter

A simple event emiiter utility to subscribe, emit and release events.

Installation

npm install my-custom-event-emitter

Usage

Example:

# import package
const Emitter = require("my-custom-event-emitter");

# initialise the constructor from imported package
const emitter = new Emitter();

# subscribe expects two arguments, one is event type and other is callback
emitter.subscribe('message', (args) => console.log(args));

# emit takes take multiple arguments where the first argument must with event type which you wan to emit
emitter.emit('message', 'arg1', 'arg2');

# release the event type by passing event type as argument to release method
emitter.release('message');
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago