UNPKG

@lucsoft/webgen

Version:

Collection of lucsofts Components

26 lines (25 loc) 881 B
import { createElement, span } from "../components/Components"; import '../css/cards.webgen.static.css'; import '../css/dialog.webgen.static.css'; export class RenderingX { constructor() { const notify = document.querySelector('#notify'); if (notify) this.staticNotify = notify; else { const notifyNew = createElement('div'); notifyNew.id = "notify"; notifyNew.classList.add('notify'); document.body.append(notifyNew); this.staticNotify = notifyNew; } } notify(test, keepOpenUntilDone) { const notifcation = span(test); if (keepOpenUntilDone === undefined) setTimeout(() => notifcation.remove(), 6010); else keepOpenUntilDone().then(() => notifcation.remove()); this.staticNotify.append(notifcation); } }