react-universal-toast
Version:
A lightweight, customizable toast notification system for React applications with TypeScript support.
18 lines (17 loc) • 474 B
TypeScript
import { ReactNode } from "react";
import { Toast } from "./types";
type Listener = (toasts: Toast[]) => void;
declare class ToastStore {
toasts: Toast[];
private listeners;
get currentToasts(): Toast[];
subscribe(listener: Listener): () => void;
private notify;
show(message: ReactNode, opts?: {
type?: Toast["type"];
}): string;
remove(id: string): void;
clear(): void;
}
export declare const toastStore: ToastStore;
export {};