Updates docs js function

This commit is contained in:
Elton Mesquita 2020-09-17 19:03:02 +01:00
parent fcd44f4d44
commit e2f4314c29
2 changed files with 3 additions and 5 deletions

View File

@ -1123,12 +1123,10 @@ element.style.setProperty('--animate-duration', '0.5s');
// When the animation ends, we clean the classes and resolve the Promise
function handleAnimationEnd() {
node.classList.remove(`${prefix}animated`, animationName);
node.removeEventListener('animationend', handleAnimationEnd);
resolve('Animation ended');
}
node.addEventListener('animationend', handleAnimationEnd);
node.addEventListener('animationend', handleAnimationEnd, {once: true});
});
</code></pre>
<p>And use it like this:</p>

View File

@ -37,12 +37,12 @@ const animateCSS = (element, animation, prefix = 'animate__') =>
node.classList.add(`${prefix}animated`, animationName);
// When the animation ends, we clean the classes and resolve the Promise
handleAnimationEnd = () => {
function handleAnimationEnd() {
node.classList.remove(`${prefix}animated`, animationName);
resolve('Animation ended');
}
node.addEventListener('animationend', handleAnimationEnd, {once : true});
node.addEventListener('animationend', handleAnimationEnd, {once: true});
});
```