Files
GameList/wwwroot/js/dom.js

13 lines
405 B
JavaScript

export const $ = (id) => document.getElementById(id);
const toastEl =
typeof document !== "undefined" ? document.getElementById("toast") : null;
export function toast(msg, isError = false) {
if (!toastEl) return;
toastEl.textContent = msg;
toastEl.classList.remove("hidden");
toastEl.classList.toggle("error", isError);
setTimeout(() => toastEl.classList.add("hidden"), 2000);
}