AWESSOMEEE now converted animation queue to promise based too

This commit is contained in:
Peter Cottle 2013-06-02 17:32:34 -07:00
parent 4619eb370c
commit c8d117073f
4 changed files with 66 additions and 21 deletions

View file

@ -842,12 +842,10 @@ GitEngine.prototype.fakeTeamwork = function(numToMake) {
var chainStep = _.bind(function() {
var newCommit = makeOriginCommit();
var animation = this.animationFactory.genCommitBirthPromiseAnimation(
return this.animationFactory.playCommitBirthPromiseAnimation(
newCommit,
this.origin.gitVisuals
);
animation.play();
return animation.getPromise();
}, this);
var deferred = Q.defer();
@ -862,6 +860,7 @@ GitEngine.prototype.fakeTeamwork = function(numToMake) {
return chainStep();
});
}
this.animationQueue.thenFinish(chain);
deferred.resolve();
};
@ -1764,13 +1763,16 @@ GitEngine.prototype.dispatch = function(command, deferred) {
return;
}
var willStartAuto = this.animationQueue.get('defer') ||
this.animationQueue.get('promiseBased');
// only add the refresh if we didn't do manual animations
if (!this.animationQueue.get('animations').length && !this.animationQueue.get('defer')) {
if (!this.animationQueue.get('animations').length && !willStartAuto) {
this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals);
}
// animation queue will call the callback when its done
if (!this.animationQueue.get('defer')) {
if (!willStartAuto) {
this.animationQueue.start();
}
};