ldc-showroom/plugins/emitter.ts
2025-06-26 11:12:53 +02:00

17 lines
330 B
TypeScript

import mitt from "mitt";
type Events = {
toast: {message:string, type:ToastTypeEnum, title: string|null};
};
const emitter = mitt<Events>();
const $bus = {
$on: emitter.on,
$emit: emitter.emit,
};
export type $Bus = typeof $bus;
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.provide("bus", $bus);
});