-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
const ee = new EventEmitter()
// 绑定事件
ee.on('someAction', (a, b, c) => {
console.log('action1',a,b,c)
)
// 绑定事件
ee.on('someAction', (a, b, c)=>{
console.log('action2', a, b, c)
})
// 绑定单次事件
ee.once('someAction', (a, b, c)=> {
console.log('actionOnce', a, b, c)
})
// 触发事件
ee.emit('someAction', 1, 2, 3)
// 输出 action1 1 2 3
// 输出 action2 1 2 3
// acitonOnce 1 2 3
// 再次触发事件
ee.emit('someAction', 3,4,5)
// 输出 action1 3 4 5
// 输出 action2 3 4 5Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels