mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
⚡ Perf: use native once listener
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
-4
@@ -28,12 +28,10 @@ class Util {
|
||||
animateCSS(element, animation, reserved, callback) {
|
||||
!Array.isArray(animation) && (animation = [animation]);
|
||||
element.classList.add('animate__animated', ...animation);
|
||||
const handler = () => {
|
||||
element.addEventListener('animationend', () => {
|
||||
!reserved && element.classList.remove('animate__animated', ...animation);
|
||||
element.removeEventListener('animationend', handler);
|
||||
typeof callback === 'function' && callback();
|
||||
};
|
||||
element.addEventListener('animationend', handler, false);
|
||||
}, { once: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user