Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async transition(animationType, transitionClass) {
let element = this.el;
let className = `${transitionClass}-${animationType}`;
let activeClassName = `${className}-active`;
// add first class right away
this.addClass(className);
await nextTick()
// This is for to force a repaint,
// which is necessary in order to transition styles when adding a class name.
element.scrollTop;
// add active class after repaint
this.addClass(activeClassName);
// if we're animating a class removal
// we need to remove the class
if (animationType === 'remove') {
this.removeClass(transitionClass);
}
// wait for ember to apply classes
// set timeout for animation end
await sleep(computeTimeout(element) || 0);
async didInstall() {
this.applyClasses();
let transitionClass = this.transitionClass;
if (transitionClass) {
let animationType = 'enter';
let className = `${transitionClass}-${animationType}`;
this.addClass(className);
await nextTick();
await this.transition('enter', transitionClass);
if (this.args.named.didTransitionIn) {
this.args.named.didTransitionIn();
}
}
}