(id)
| 253 | } |
| 254 | |
| 255 | function dismissToastNotification(id) { |
| 256 | const toastData = activeToasts.get(id); |
| 257 | if (!toastData) return false; |
| 258 | |
| 259 | const { element, timeoutId } = toastData; |
| 260 | |
| 261 | if (timeoutId) clearTimeout(timeoutId); |
| 262 | activeToasts.delete(id); |
| 263 | |
| 264 | // Add exit animation class |
| 265 | element.classList.add('exiting'); |
| 266 | |
| 267 | // Remove from DOM after animation |
| 268 | element.addEventListener('animationend', () => { |
| 269 | if (element.parentNode) { |
| 270 | element.parentNode.removeChild(element); |
| 271 | } |
| 272 | // Cleanup container if empty |
| 273 | const container = document.querySelector('.ds-toast-container'); |
| 274 | if (container && container.children.length === 0) { |
| 275 | container.remove(); |
| 276 | } |
| 277 | }); |
| 278 | |
| 279 | return true; |
| 280 | } |
| 281 | |
| 282 | // --- Export --- |
| 283 | window.showToastNotification = showToastNotification; |
no test coverage detected