seniorVue.js

Architecting a Global 'Event Bus' in Vue 3: Alternatives to the Removed $on/$off

Updated May 4, 2026

Short answer

Since Vue 3 removed the internal event emitter API, architectural patterns now favor external libraries like 'mitt' or using a Pinia-based notification store.

Deep explanation

In Vue 2, many developers used a Vue instance as a global bus. In Vue 3, the recommended approach is decoupling. For strictly event-driven logic (like a global 'Toast' trigger from a JS utility file), libraries like mitt provide a 200-byte emitter. However, for most architectural needs, a 'Command Pattern' via Pinia is superior: an action is dispatched to a store, and interested components 'watch' a state change in that store. This provides a clear audit trail in DevTools.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Vue.js interview questions

View all →