企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## useEventBus ``` const bus = useEventBus<string>('news') function listener(event: string) { console.log(`news: ${event}`) } function listener1(event: string) { console.log(`news1: ${event}`) } // listen to an event const unsubscribe = bus.on(listener) const unsubscribe1 = bus.on(listener1) setTimeout(()=>{ bus.emit('The Tokyo Olympics has begun') },1000) ```