2015-08-27 22:52:30 +02:00
|
|
|
var Events = {
|
|
|
|
ANIMATION_END: 'webkitAnimationEnd'
|
|
|
|
};
|
2015-08-26 20:17:18 +02:00
|
|
|
|
2015-08-27 22:52:30 +02:00
|
|
|
module.exports = {
|
2015-08-26 20:17:18 +02:00
|
|
|
|
2015-08-27 22:52:30 +02:00
|
|
|
play: function(component, animation) {
|
2015-08-26 20:17:18 +02:00
|
|
|
return new Promise(function(resolve, reject) {
|
2015-08-27 22:52:30 +02:00
|
|
|
|
|
|
|
var el = component.getDOMNode();
|
|
|
|
|
2015-08-26 20:17:18 +02:00
|
|
|
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-26 20:17:18 +02:00
|
|
|
|
2015-08-27 22:52:30 +02:00
|
|
|
};
|