as-toast
Version:
Simple and customizable toast notifications for Svelte
18 lines (17 loc) • 557 B
TypeScript
import type { Writable } from 'svelte/store';
export interface Toast {
id: string;
msg: string;
type: 'info' | 'warn';
removeAfter: number;
}
export declare const toasts: Writable<Toast[]>;
/**
*
* @param msg Toast message, can be any HTML.
* @param type Toast type ('info' or 'warn')
* @param removeAfter Time in milliseconds the toast will be displayed
* @returns id of Toast
*/
export declare function addToast(msg: string, type?: Toast['type'], removeAfter?: number): string;
export declare function removeToast(id: string): void;