WebIndex/plugins/mitt.ts

18 lines
250 B
TypeScript
Raw Normal View History

2024-12-18 08:42:00 +08:00
import mitt from 'mitt'
2025-01-13 23:12:06 +08:00
interface Events {
2025-01-13 21:51:37 +08:00
openPost: IPost
startLoading: boolean
eventBus: INotification
2024-12-18 08:42:00 +08:00
}
export default defineNuxtPlugin(() => {
2025-01-13 21:51:37 +08:00
const emitter = mitt<Events>()
2024-12-18 08:42:00 +08:00
2025-01-13 21:51:37 +08:00
return {
provide: {
mitt: emitter,
},
}
})