UNPKG

1.77 kBTypeScriptView Raw
1import { Toast, ToastType } from './toast';
2import { IClearWrapper } from './clearWrapper';
3import { Observable, Subject } from 'rxjs';
4export declare class ToasterService {
5 addToast: Observable<Toast>;
6 private _addToast;
7 clearToasts: Observable<IClearWrapper>;
8 private _clearToasts;
9 removeToast: Observable<IClearWrapper>;
10 /** @internal */
11 _removeToastSubject: Subject<IClearWrapper>;
12 /**
13 * Creates an instance of ToasterService.
14 */
15 constructor();
16 /**
17 * Synchronously create and show a new toast instance.
18 *
19 * @param {(string | Toast)} type The type of the toast, or a Toast object.
20 * @param {string=} title The toast title.
21 * @param {string=} body The toast body.
22 * @returns {Toast}
23 * The newly created Toast instance with a randomly generated GUID Id.
24 */
25 pop(type: ToastType | Toast, title?: string, body?: string): Toast;
26 /**
27 * Asynchronously create and show a new toast instance.
28 *
29 * @param {(string | Toast)} type The type of the toast, or a Toast object.
30 * @param {string=} title The toast title.
31 * @param {string=} body The toast body.
32 * @returns {Observable<Toast>}
33 * A hot Observable that can be subscribed to in order to receive the Toast instance
34 * with a randomly generated GUID Id.
35 */
36 popAsync(type: ToastType | Toast, title?: string, body?: string): Observable<Toast>;
37 /**
38 * Clears a toast by toastId and/or toastContainerId.
39 *
40 * @param {string} toastId The toastId to clear.
41 * @param {number=} toastContainerId
42 * The toastContainerId of the container to remove toasts from.
43 */
44 clear(toastId?: string, toastContainerId?: number): void;
45}