Update 2025-05-21_08:58:06
This commit is contained in:
19
static/toast.js
Normal file
19
static/toast.js
Normal file
@ -0,0 +1,19 @@
|
||||
// toast.js — centralized toast notification logic for dicta2stream
|
||||
|
||||
export function showToast(message) {
|
||||
let container = document.querySelector('.toast-container');
|
||||
if (!container) {
|
||||
container = document.createElement('div');
|
||||
container.className = 'toast-container';
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
const toast = document.createElement('div');
|
||||
toast.className = 'toast';
|
||||
toast.textContent = message;
|
||||
container.appendChild(toast);
|
||||
setTimeout(() => {
|
||||
toast.remove();
|
||||
// Do not remove the container; let it persist for stacking
|
||||
}, 3500);
|
||||
}
|
||||
|
Reference in New Issue
Block a user