Files
wanderer/web/src/lib/stores/toast_store.ts
Christian Beutel 905995a01c adds user management
2024-02-02 22:48:24 +01:00

18 lines
377 B
TypeScript

import { writable, type Writable } from "svelte/store";
export type Toast = {
type: "info" | "success" | "warning" | "error"
icon: string;
text: string;
}
export const toast: Writable<Toast | null> = writable();
export function show_toast(newToast: Toast, duration: number = 3000) {
toast.set(newToast);
setTimeout(() => toast.set(null), duration);
}