ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的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) ```