Browse Source
Fix webpage in input for messageEntityTextUrl Fix webpage clearing Fix length in input field due to emoji length Fix pointer-events for sticky datemaster
Eduard Kuzmenko
4 years ago
8 changed files with 111 additions and 62 deletions
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
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; |
Loading…
Reference in new issue