0.0.1 • Published 4 years ago
myemitter v0.0.1
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
Copyright (c) 2019, Owen Luke
0.0.1
4 years ago