pitaya-launcher/js/components/mixins/animate.js

24 lines
472 B
JavaScript
Raw Normal View History

2015-08-27 22:52:30 +02:00
var Events = {
ANIMATION_END: 'webkitAnimationEnd'
};
2015-08-27 22:52:30 +02:00
module.exports = {
2015-08-27 22:52:30 +02:00
play: function(component, animation) {
return new Promise(function(resolve, reject) {
2015-08-27 22:52:30 +02:00
var el = component.getDOMNode();
el.addEventListener(Events.ANIMATION_END, onAnimEnd, false);
el.style.webkitAnimation = animation;
function onAnimEnd(evt) {
el.removeEventListener(Events.ANIMATION_END, onAnimEnd);
return resolve(el);
}
});
2015-08-27 22:52:30 +02:00
}
2015-08-27 22:52:30 +02:00
};