17 lines
330 B
TypeScript
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);
|
|
});
|