// 1.引入 import mitt from 'mitt'; // 2.调用 const emitter = mitt() // 3.绑定 // emitter.on('foo', e => console.log('foo', e) ) // 4.监听 // emitter.emit('foo', { a: 'b' }) // 5.解绑 // emitter.off('foo', xxx) // unlisten // 6.全部清除 // emitter.all.clear() // 7.抛出 export default emitter;