mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-06-16 03:05:03 -04:00
wip
This commit is contained in:
parent
9e12f62b81
commit
892f800107
14 changed files with 2866 additions and 2840 deletions
10
src/toast.ts
10
src/toast.ts
|
@ -3,16 +3,16 @@ div.classList = "hidden toast";
|
|||
document.body.appendChild(div);
|
||||
let timeout: NodeJS.Timeout | undefined;
|
||||
export function toast(html: string, className = "") {
|
||||
clearToasts()
|
||||
clearToasts();
|
||||
div.classList = "toast visible " + className;
|
||||
div.innerHTML = html;
|
||||
timeout = setTimeout(clearToasts, 1500);
|
||||
}
|
||||
|
||||
export function clearToasts(){
|
||||
export function clearToasts() {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
timeout = undefined
|
||||
timeout = undefined;
|
||||
}
|
||||
div.classList = "hidden toast";
|
||||
}
|
||||
div.classList = "hidden toast";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue