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.
26 lines
703 B
26 lines
703 B
![]()
4 years ago
|
const SetTransition = (element: HTMLElement, className: string, forwards: boolean, duration: number, onTransitionEnd?: () => void) => {
|
||
|
const timeout = element.dataset.timeout;
|
||
|
if(timeout !== undefined) {
|
||
|
clearTimeout(+timeout);
|
||
|
}
|
||
|
|
||
|
if(forwards) {
|
||
|
element.classList.add(className);
|
||
|
}
|
||
|
|
||
|
element.classList.add('animating');
|
||
|
|
||
|
element.classList.toggle('backwards', !forwards);
|
||
|
element.dataset.timeout = '' + setTimeout(() => {
|
||
|
delete element.dataset.timeout;
|
||
|
if(!forwards) {
|
||
|
element.classList.remove('backwards', className);
|
||
|
}
|
||
|
|
||
|
element.classList.remove('animating');
|
||
|
|
||
|
onTransitionEnd && onTransitionEnd();
|
||
|
}, duration);
|
||
|
};
|
||
|
|
||
|
export default SetTransition;
|