Skip to content

Commit

Permalink
* Promises.js: mooshell tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Mar 24, 2010
1 parent 3f78aae commit 796cb8f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Promises.js
Expand Up @@ -138,7 +138,15 @@ var Promise = new Class({
this.__req = req;
req.addEvent('onSuccess', function(r) {
var json = ($type(r) == 'object') ? r : ((!req.options.bare) ? JSON.decode(r) : r),
v = (Promise.deref !== null && json[Promise.deref] !== null && json[Promise.deref] !== undefined) ? json[Promise.deref] : json;
v;
if(Promise.deref !== null) {
var temp = Function.get.apply(null, [json].concat(Promise.deref.split(".")));
if(temp !== null && temp !== undefined) {
v = temp;
}
} else {
v = json;
}
this.deliver(this.applyOps(v));
}.bind(this));
req.addEvent('onFailure', function(responseText) {
Expand Down

0 comments on commit 796cb8f

Please sign in to comment.