import { Awaitable } from "../../../util/data"; import { GameState } from "../gameState"; import { LiveGameEventToken } from "../../../game/nlcore/types"; export type Notification = { message: string; id: string; duration: number | null; }; export declare class NotificationArray { private readonly notifications; static create(notifications: Notification[]): NotificationArray; private readonly stringified; private constructor(); private wrap; /** * Map the notifications to a new array * * **Note:** The callback function is called with the notification message, the **id** of the notification, and the array of notifications. * * @param callbackfn - The callback function * @returns The new array */ map(callbackfn: (notification: string, id: string, array: string[]) => U): U[]; filter(callbackfn: (notification: string, id: string, array: string[]) => boolean): string[]; forEach(callbackfn: (notification: string, id: string, array: string[]) => void): void; find(callbackfn: (notification: string, id: string, array: string[]) => boolean): string | undefined; findIndex(callbackfn: (notification: string, id: string, array: string[]) => boolean): number; } export declare class NotificationManager { gameState: GameState; notifications: Notification[]; private readonly events; constructor(gameState: GameState, notifications: Notification[]); addNotification(notification: Notification): void; removeNotification(notification: Notification): void; clearNotifications(): void; /** * Consume a notification * * @param notification - The notification to consume * @returns A promise that resolves when the notification is consumed */ consume(notification: Notification): Awaitable; onFlush(callback: () => void): LiveGameEventToken; toArray(): Notification[]; private flush; }