Permalink
Browse files

* Promises.js: change for nested objects that contain promises

  • Loading branch information...
1 parent b9b9553 commit 5adcfaaf0288683a40c0d0c717662a172331b14a @swannodette swannodette committed Jun 10, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 Promises.js
View
@@ -89,6 +89,7 @@ var Promise = new Class({
// if handed an object look for promises in the values - handles the recursive case
// however you should not put anything in the promise except normal values or promises
// i.e. no custom instances
+ this.__object = value;
this.__isObject = true;
var ps = $treeFilter(value, Promise.isPromise, Promise.isPromise);
Promise.watch(ps, function(promises) {
@@ -214,6 +215,9 @@ var Promise = new Class({
} else {
this.__promise.realize();
}
+ } else if(this.__object) {
+ var ps = $treeFilter(this.__object, Promise.isPromise, Promise.isPromise);
+ ps.map(Function.msg("realize"));
}
return this;
},

0 comments on commit 5adcfaa

Please sign in to comment.