feat: New features (research, invest, gambling, new game+, trophies)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { $, h } from './dom.js';
|
||||
|
||||
const DURATION_MS = 6000;
|
||||
const MAX_VISIBLE = 3; // a big jump (import, long absence) must not bury the page in messages
|
||||
|
||||
export function showToast(message, { error = false } = {}) {
|
||||
const container = $('#toasts');
|
||||
const toast = h('p', { class: error ? 'toast toast--error' : 'toast', text: message });
|
||||
$('#toasts').append(toast);
|
||||
container.append(toast);
|
||||
while (container.children.length > MAX_VISIBLE) container.firstElementChild.remove();
|
||||
setTimeout(() => toast.remove(), DURATION_MS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user