loading
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const EventEmitter = require('events');

const emitter = new EventEmitter();

emitter.on('message',function(message) {

  console.log("subsribed",message);
})

emitter.emit('message',{ data : "Data" });

/**
 * Event Emitter Logger Funtionality
 */

const Logger = require('./Logger');

const logger = new Logger();


logger.on('logMessage',(arg) => {
   console.log("Listened value => ",arg);
})


logger.logIt('logMessage',{ name : 'John',age : 40 })
node v10.16.0