morethanwords 82043e4c4a Several little fixes
Gif Safari & round videos fix
2020-08-24 17:09:31 +03:00

12 lines
372 B
TypeScript

const toastEl = document.createElement('div');
toastEl.classList.add('toast');
export function toast(html: string) {
toastEl.innerHTML = html;
document.body.append(toastEl);
if(toastEl.dataset.timeout) clearTimeout(+toastEl.dataset.timeout);
toastEl.dataset.timeout = '' + setTimeout(() => {
toastEl.remove();
delete toastEl.dataset.timeout;
}, 3000);
}