0.0.1 • Published 4 years ago

myemitter v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

My Emitter

Provide a unique Emitter for your project so that modules within the project can communicate with each other.

Demo

a.js

const emitter = require('myemitter');
emitter.on('ready', () => {
    console.log('a');
})

b.js

const emitter = require('myemitter');
emitter.on('ready', () => {
    console.log('b');
})

index.js

const a = require('./a');
const b = require('./b');

const emitter = require('myemitter');
emitter.emit('ready');

Run index.js, then the result will be like below:

a
b

See examples

License

MIT

Copyright (c) 2019, Owen Luke