-
獲取監(jiān)聽(tīng)個(gè)數(shù)查看全部
-
顯示監(jiān)聽(tīng)個(gè)數(shù)
查看全部 -
water()
查看全部 -
//?引入事件模塊 var?EventEmitter?=?require('events').EventEmitter //?創(chuàng)建實(shí)例 var?life?=?new?EventEmitter() //?默認(rèn)監(jiān)聽(tīng)事件最大值是10,可以更改最大值 life.setMaxListeners(11) function?water(what)?{ ????console.log('like?'?+?what?+?',?oh?removed!') } //?監(jiān)聽(tīng)事件 life.on('like',?function(what)?{ ????console.log('like?'?+?what?+?'?etc.') }) life.on('like',?function(what)?{ ????console.log('like'?+?what?+?',?oh?yeah!') }) //?移除對(duì)應(yīng)的事件 life.removeListener('like',?water) //?移除所有的對(duì)應(yīng)事件 life.removeAllListeners('like') //?移除所有事件 life.removeAllListeners() //?觸發(fā)事件,返回值是true?|?false,代表有沒(méi)有對(duì)應(yīng)的事件 var?hasLikeListener?=?life.emit('like',?'football') #?=>?true var?hasLoveListener?=?life.emit('love',?'football') #?=>?false //?查看事件數(shù)量 console.log(life.listeners('like').length) console.log(life.listeners('love').length) console.log(EventEmitter.listenerCount(life,?'like')
查看全部 -
清除函數(shù)的方式
查看全部 -
emit()返回是否被監(jiān)聽(tīng)過(guò)查看全部
-
setMaxListeners()
查看全部 -
事件設(shè)置不要超過(guò)10個(gè)
查看全部 -
events.js
查看全部 -
node -v
npm -v
查看全部 -
linux 發(fā)行版的包工具
查看全部 -
yum -y
查看全部 -
linux環(huán)境查看
查看全部 -
安裝環(huán)境的要求
查看全部 -
printCourseInfo查看全部
舉報(bào)
0/150
提交
取消