Telegram Web K with changes to work inside I2P https://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
888 B

3 years ago
/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
2 years ago
import replaceContent from '../helpers/dom/replaceContent';
import {FormatterArguments, i18n, LangPackKey} from '../lib/langPack';
3 years ago
const toastEl = document.createElement('div');
toastEl.classList.add('toast');
export function toast(content: string | Node) {
replaceContent(toastEl, content);
document.body.append(toastEl);
if(toastEl.dataset.timeout) clearTimeout(+toastEl.dataset.timeout);
toastEl.dataset.timeout = '' + setTimeout(() => {
toastEl.remove();
delete toastEl.dataset.timeout;
}, 3000);
}
export function toastNew(options: Partial<{
langPackKey: LangPackKey,
langPackArguments: FormatterArguments
3 years ago
}>) {
toast(i18n(options.langPackKey, options.langPackArguments));
3 years ago
}