(message, isSuccess = true, duration = 3000)
| 188 | |
| 189 | // Function to show the prompt with a success or error message |
| 190 | export function showPrompt(message, isSuccess = true, duration = 3000) { |
| 191 | prompt.textContent = message; |
| 192 | prompt.classList.toggle('error', !isSuccess); |
| 193 | prompt.classList.add('show'); |
| 194 | const container = document.querySelector('.prompt-container'); |
| 195 | try { |
| 196 | if (container && !container.matches(':popover-open')) container.showPopover(); |
| 197 | } catch (e) {} |
| 198 | if (window.promptTimeout) { |
| 199 | clearTimeout(window.promptTimeout); |
| 200 | } |
| 201 | window.promptTimeout = setTimeout(() => { |
| 202 | prompt.classList.remove('show'); |
| 203 | try { if (container && container.matches(':popover-open')) container.hidePopover(); } catch (e) {} |
| 204 | }, duration); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Redirect to a link with am command |
no outgoing calls
no test coverage detected