promise animation basic API working

This commit is contained in:
Peter Cottle 2013-06-02 16:29:01 -07:00
parent d208905b77
commit 4b003f057e
2 changed files with 10 additions and 6 deletions

View file

@ -9485,12 +9485,14 @@ var PromiseAnimation = Backbone.Model.extend({
// we want to resolve a deferred when the animation finishes // we want to resolve a deferred when the animation finishes
this.get('closure')(); this.get('closure')();
setTimeout(_.bind(function() { setTimeout(_.bind(function() {
console.log('resolving deferred');
this.get('deferred').resolve(); this.get('deferred').resolve();
}, this), this.get('duration')); }, this), this.get('duration'));
console.log('the duration', this.get('duration'));
}, },
then: function() { then: function(func) {
return this.get('deferred').promise.then(); return this.get('deferred').promise.then(func);
} }
}); });
@ -31536,12 +31538,14 @@ var PromiseAnimation = Backbone.Model.extend({
// we want to resolve a deferred when the animation finishes // we want to resolve a deferred when the animation finishes
this.get('closure')(); this.get('closure')();
setTimeout(_.bind(function() { setTimeout(_.bind(function() {
console.log('resolving deferred');
this.get('deferred').resolve(); this.get('deferred').resolve();
}, this), this.get('duration')); }, this), this.get('duration'));
console.log('the duration', this.get('duration'));
}, },
then: function() { then: function(func) {
return this.get('deferred').promise.then(); return this.get('deferred').promise.then(func);
} }
}); });

View file

@ -113,8 +113,8 @@ var PromiseAnimation = Backbone.Model.extend({
console.log('the duration', this.get('duration')); console.log('the duration', this.get('duration'));
}, },
then: function() { then: function(func) {
return this.get('deferred').promise.then(); return this.get('deferred').promise.then(func);
} }
}); });