Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
refactor code
Replaces lines 119 through 125
applyCrierAttributes(crierElement, crierInfo, options) {
crierElement.style.position = 'static';
crierElement.style.height = `${crierInfo.height}px`;
crierElement.setAttribute('data-height', `${crierInfo.height}px`);
crierElement.style.justifySelf = options.justifySelf;
if (options.shadow) {
crierElement.classList.add('crier-shadow');
}
}
queueCrierRemovalWithoutProgressBar(crierElement, duration) {
window.setTimeout(()=> {
this.removeCrier(crierElement);
}, duration);
}
queueCrierRemovalWithProgressBar(crierElement, duration, options) {
const progressBar = document.getElementById(`pb${options.idNumber}`);
progressBar.parentElement.classList.add('outline');
dom.addAndRemoveHandler(progressBar, 'transitionend', (event) => {
this.removeCrier(crierElement);
});
dom.applyTransition(progressBar, (element) => {
element.style.width = 0;
element.style.transition = `width ${duration}ms ease`;
element.style.width = `${progressBar.parentElement.clientWidth}px`;
})
}
const duration = newCrierElement.getAttribute('data-duration');
if (newCrierElement.getAttribute('data-close-type') !== 'user') {
queueCrierRemovalWithoutProgressBar(newCrierElement, duration);
}
else {
queueCrierRemovalWithProgressBar(newCrierElement, duration, options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.