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

24 lines
472 B
JavaScript

var Events = {
ANIMATION_END: 'webkitAnimationEnd'
};
module.exports = {
play: function(component, animation) {
return new Promise(function(resolve, reject) {
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);
}
});
}
};