( message: string, type: "success" | "error" = "success" )
| 321 | * Show a toast notification |
| 322 | */ |
| 323 | export function showToast( |
| 324 | message: string, |
| 325 | type: "success" | "error" = "success" |
| 326 | ): void { |
| 327 | const existing = document.querySelector(".toast"); |
| 328 | if (existing) existing.remove(); |
| 329 | |
| 330 | const toast = document.createElement("div"); |
| 331 | toast.className = `toast ${type}`; |
| 332 | toast.textContent = message; |
| 333 | document.body.appendChild(toast); |
| 334 | |
| 335 | setTimeout(() => { |
| 336 | toast.remove(); |
| 337 | }, 3000); |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Debounce function for search input |
no outgoing calls
no test coverage detected