4.0.1 • Published 4 years ago

emitify v4.0.1

Weekly downloads
164
License
MIT
Repository
github
Last release
4 years ago

Emitify License NPM version Dependency Status Build Status Coverage Status

Dead simple event emitter.

Install

npm i emitify --save

API

What you should do first is create new instance of emitify with

const emitify = Emitify();

Than you could just use API as it is.

emitter.on(event, callback)

Add callback listener to event.

emitter.off(event, callback)

Remove callback listener from event.

emitter.emit(event , data1, data2, ..., dataN)

Emit event with (or without) data.

emitter.addListener(event, callback)

Alias to emitter.on.

emitter.removeListener(event, callback)

Alias to emitter.off.

emitter.removeAllListeners(event)

Removes all listeners related to event.

How to use?

const Emitify = require('emitify');
const emitter = new Emitify();
const log = (data) => {
    console.log(data);
});

emitter.on('data', log);

emitter.emit('data', 'hello');

emitter.off('data', log);

License

MIT

4.0.1

4 years ago

4.0.0

4 years ago

3.1.0

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago