UNPKG

1.39 kBTypeScriptView Raw
1import { Disposable, ErrorNotificationOptions, Notification, NotificationOptions } from '../index';
2
3/** A notification manager used to create Notifications to be shown to the user. */
4export interface NotificationManager {
5 // Events
6 /** Invoke the given callback after a notification has been added. */
7 onDidAddNotification(callback: (notification: Notification) => void): Disposable;
8
9 /** Invoke the given callback after the notifications have been cleared. */
10 onDidClearNotifications(callback: () => void): Disposable;
11
12 // Adding Notifications
13 /** Add a success notification. */
14 addSuccess(message: string, options?: NotificationOptions): Notification;
15
16 /** Add an informational notification. */
17 addInfo(message: string, options?: NotificationOptions): Notification;
18
19 /** Add a warning notification. */
20 addWarning(message: string, options?: NotificationOptions): Notification;
21
22 /** Add an error notification. */
23 addError(message: string, options?: ErrorNotificationOptions): Notification;
24
25 /** Add a fatal error notification. */
26 addFatalError(message: string, options?: ErrorNotificationOptions): Notification;
27
28 // Getting Notifications
29 /** Get all the notifications. */
30 getNotifications(): ReadonlyArray<Notification>;
31
32 // Managing Notifications
33 /** Clear all the notifications. */
34 clear(): void;
35}