const { EventEmitter } = require('events')
const ee = new EventEmitter()
setInterval(() => {
ee.emit('ping', ` [${Date.now()}]: wake up`)
}, 3000)
module.exports = ee
'use strict'
const ee = require('./ee')
ee.on('ping', (value) => {
console.log(`Listener 1, recived:${value}`)
})
ee.on('ping', (value) => {
console.log(`Listener 2, recived:${value}`)
})
setTimeout(() => {
console.log('Remove all listener')
ee.removeAllListeners()
}, 10_000)