Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initAllBoxes() {
if (this.allBoxes.length) {
return Promise.resolve();
}
return functionToPromise(() => {
let swiperWrapper = null;
if (this.swiper.wrapperEl) {
// swiper 4+
swiperWrapper = this.swiper.wrapperEl;
} else if (this.swiper.wrapper) {
// swiper 3.x
swiperWrapper = this.swiper.wrapper[0];
}
this.allBoxes = [
...nodeListToArray(swiperWrapper.querySelectorAll('[data-swiper-animation]')),
...nodeListToArray(swiperWrapper.querySelectorAll('[data-swiper-animation-once]'))
];
});
}
render() {
return functionToPromise(() => {
this.context.innerHTML = templateLoading({_style, imgLoading});
document.body.appendChild(this.context);
});
};
load() {
return functionToPromise(() => {
this.wrapper.innerHTML = promptOrientation({
_style,
suggest: 'Turn to portrait for better experience.',
});
}).then(() => {
document.body.appendChild(this.wrapper);
});
};
render({
pugTemplate,
wrapperElement,
insetParam,
isAddToEl = false,
}) {
return functionToPromise(() => new Templates(pugTemplate, wrapperElement, insetParam).load(isAddToEl));
};
const runOutTasks = this.activeBoxes.map((el) => {
if (el.animationData.isRecovery) {
return Promise.resolve();
}
if (!el.animationData.outEffect) {
return Promise.resolve();
}
return functionToPromise(() => {
el.style.cssText = el.styleCache;
el.style.visibility = 'visible';
el.style.cssText += ` animation-duration:${el.animationData.outDuration}; -webkit-animation-duration:${el.animationData.outDuration};`;
el.classList.add(el.animationData.outEffect, 'animated');
}, 500);
});