nodejs emitter 小例子

2017-12-13  本文已影响8人  saronic

先把代码放在这里,以后再更新

const events = require('events')
const emitter = new events.EventEmitter();

emitter.on('knock', () => {console.log('who is there')})
emitter.on('knock', () => {console.log('go away')})

emitter.emit('knock')
上一篇 下一篇

猜你喜欢

热点阅读