mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-06-15 18:54:47 -04:00
wip
This commit is contained in:
parent
258d578ad3
commit
9731d694f3
8 changed files with 791 additions and 722 deletions
13
src/toast.ts
13
src/toast.ts
|
@ -3,13 +3,16 @@ div.classList = "hidden toast";
|
|||
document.body.appendChild(div);
|
||||
let timeout: NodeJS.Timeout | undefined;
|
||||
export function toast(html: string, className = "") {
|
||||
clearToasts()
|
||||
div.classList = "toast visible " + className;
|
||||
div.innerHTML = html;
|
||||
timeout = setTimeout(clearToasts, 1500);
|
||||
}
|
||||
|
||||
export function clearToasts(){
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
timeout = undefined
|
||||
}
|
||||
timeout = setTimeout(() => {
|
||||
timeout = undefined;
|
||||
div.classList = "hidden toast";
|
||||
}, 1500);
|
||||
}
|
||||
div.classList = "hidden toast";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue