const EventEmitter = require('events')
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter()
let times = 0
myEmitter.on('canReceive', function () {
console.log(++times)
myEmitter.emit('canReceive')
})
myEmitter.emit('canReceive')
为何栈溢出了,有什么方式可以一直触发但是防止溢出吗?
蓝山帝景
郎朗坤
相关分类