constProEventBus=require('pro-event-bus')consteventBus=newProEventBus()eventBus.on('test',()=>{console.log('test pro-event-bus');})eventBus.once('once',()=>{console.log('test pro-event-bus-once');})eventBus.emit('test')eventBus.emit('test')eventBus.emit('once')eventBus.emit('once')eventBus.offAll()eventBus.emit('test')/* test pro-event-bus test pro-event-bus test pro-event-bus-once*/
web
<scriptsrc="./pro-event-bus/index.js"></script>// https://cdn.jsdelivr.net/npm/pro-event-bus@1.0.4/index.js<script>consteventBus=newProEventBus()eventBus.on('test',()=>{console.log('test pro-event-bus');})eventBus.once('once',()=>{console.log('test pro-event-bus-once');})eventBus.emit('test')eventBus.emit('test')eventBus.emit('once')eventBus.emit('once')eventBus.offAll()eventBus.emit('test')/* ② test pro-event-bus test pro-event-bus-once */</script>