Adds a new toast to the queue.
(content: T, options: ToastOptions = {})
| 115 | |
| 116 | /** Adds a new toast to the queue. */ |
| 117 | add(content: T, options: ToastOptions = {}): string { |
| 118 | let toastKey = '_' + Math.random().toString(36).slice(2); |
| 119 | let toast: QueuedToast<T> = { |
| 120 | ...options, |
| 121 | content, |
| 122 | key: toastKey, |
| 123 | timer: options.timeout ? new Timer(() => this.close(toastKey), options.timeout) : undefined |
| 124 | }; |
| 125 | |
| 126 | this.queue.unshift(toast); |
| 127 | |
| 128 | this.updateVisibleToasts('add'); |
| 129 | return toastKey; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Closes a toast. |
nothing calls this directly
no test coverage detected