UNPKG

daisy-data-components

Version:

The "daisy-data-components" NPM package transforms general UI components from daisyUI into specialized "data components", such as Data Tables and Data Date Pickers, optimized for working with data-centric applications. It provides powerful functionality t

28 lines (23 loc) 628 B
import EventEmitter from "../emitter"; export interface Toast { id: string; message: string; classes: string; } export interface ToastEvent { id?: string; message: string; type?: 'error' | 'info' | 'success' | 'warning'; duration?: number; styling?: string; } export const TOAST_NOTIFICATION_KEY = 'toast-notifications'; export function displayToast(emitter: EventEmitter, event: ToastEvent | string) { let data: ToastEvent; if (typeof event === 'string') { data = {message: event} } else { data = event; } emitter.publish(TOAST_NOTIFICATION_KEY, data); }