vue-common/src/toast.service.ts

17 lines
288 B
TypeScript

import mitt from 'mitt';
export interface ToastMessage {
detail?: string;
duration?: number | 'manual';
icon?: string;
message: string;
}
type ToastEvents = {
info: ToastMessage;
error: ToastMessage;
success: ToastMessage;
};
export const toastBus = mitt<ToastEvents>();