banner-builder
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -16,25 +16,8 @@ 'use strict'; | ||
this._listenEnd = function () { | ||
_this.deferred = Promise.defer(); | ||
_this.el.addEventListener('transitionend', _this._handleEnd); | ||
_this.el.addEventListener('animationend', _this._handleEnd); | ||
}; | ||
this.resolve = new Function(); | ||
this._handleStart = function (e) { | ||
_this._clearTimeout(); | ||
}; | ||
this._clearTimeout = function (e) { | ||
clearTimeout(_this.timeout); | ||
}; | ||
this._setTimeout = function () { | ||
_this.timeout = setTimeout(function () { | ||
_this.deferred.reject(new Error('Animate callback did not trigger a transtionstart|animationstart event.')); | ||
}, TIMEOUT_DURATION); | ||
}; | ||
this._handleEnd = function () { | ||
_this.deferred.resolve(); // TODO check if this.deferred is resolvable. | ||
_this.el.removeEventListener('transitionend', _this._handleEnd); | ||
console.log('end'); | ||
_this.resolve(); | ||
_this.resolve = new Function(); | ||
}; | ||
@@ -47,6 +30,6 @@ | ||
this.animateSync = function () { | ||
// this._setTimeout(); | ||
_this._listenEnd(); | ||
_this.animate(); | ||
return _this.deferred.promise; | ||
return new Promise(function (resolve) { | ||
_this.resolve = resolve; | ||
requestAnimationFrame(_this.animate); | ||
}); | ||
}; | ||
@@ -59,29 +42,14 @@ | ||
this.resetSync = function () { | ||
// this._setTimeout(); | ||
_this._listenEnd(); | ||
_this.reset(); | ||
return _this.deferred.promise; | ||
return new Promise(function (resolve) { | ||
_this.resolve = resolve; | ||
requestAnimationFrame(_this.reset); | ||
}); | ||
}; | ||
this.el = el; | ||
this.el.addEventListener('transitionstart', this._handleStart); | ||
this.el.addEventListener('animationstart', this._handleStart); | ||
this.el.addEventListener('transitionend', this._handleEnd); | ||
this.el.addEventListener('animationend', this._handleEnd); | ||
} | ||
/** | ||
* | ||
*/ | ||
/* | ||
* Listens for transtion-start events, to make sure 'sync' events are actually being performed on animating objects. | ||
*/ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* Resolve this object's 'deferred' property. | ||
@@ -88,0 +56,0 @@ * |
{ | ||
"name": "banner-builder", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dst/index.js", |
7104
221