Commit 231222e1 authored by Tom Dale's avatar Tom Dale

Update builds from RSVP.async hookable change

parent efdb4704
...@@ -180,13 +180,13 @@ define("rsvp", ...@@ -180,13 +180,13 @@ define("rsvp",
var thenPromise = new Promise(); var thenPromise = new Promise();
if (this.isResolved) { if (this.isResolved) {
rsvp.async(function() { RSVP.async(function() {
invokeCallback('resolve', thenPromise, done, { detail: this.resolvedValue }); invokeCallback('resolve', thenPromise, done, { detail: this.resolvedValue });
}, this); }, this);
} }
if (this.isRejected) { if (this.isRejected) {
rsvp.async(function() { RSVP.async(function() {
invokeCallback('reject', thenPromise, fail, { detail: this.rejectedValue }); invokeCallback('reject', thenPromise, fail, { detail: this.rejectedValue });
}, this); }, this);
} }
...@@ -218,7 +218,7 @@ define("rsvp", ...@@ -218,7 +218,7 @@ define("rsvp",
}; };
function resolve(promise, value) { function resolve(promise, value) {
rsvp.async(function() { RSVP.async(function() {
promise.trigger('promise:resolved', { detail: value }); promise.trigger('promise:resolved', { detail: value });
promise.isResolved = true; promise.isResolved = true;
promise.resolvedValue = value; promise.resolvedValue = value;
...@@ -226,7 +226,7 @@ define("rsvp", ...@@ -226,7 +226,7 @@ define("rsvp",
} }
function reject(promise, value) { function reject(promise, value) {
rsvp.async(function() { RSVP.async(function() {
promise.trigger('promise:failed', { detail: value }); promise.trigger('promise:failed', { detail: value });
promise.isRejected = true; promise.isRejected = true;
promise.rejectedValue = value; promise.rejectedValue = value;
......
...@@ -178,13 +178,13 @@ ...@@ -178,13 +178,13 @@
var thenPromise = new Promise(); var thenPromise = new Promise();
if (this.isResolved) { if (this.isResolved) {
rsvp.async(function() { RSVP.async(function() {
invokeCallback('resolve', thenPromise, done, { detail: this.resolvedValue }); invokeCallback('resolve', thenPromise, done, { detail: this.resolvedValue });
}, this); }, this);
} }
if (this.isRejected) { if (this.isRejected) {
rsvp.async(function() { RSVP.async(function() {
invokeCallback('reject', thenPromise, fail, { detail: this.rejectedValue }); invokeCallback('reject', thenPromise, fail, { detail: this.rejectedValue });
}, this); }, this);
} }
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
}; };
function resolve(promise, value) { function resolve(promise, value) {
rsvp.async(function() { RSVP.async(function() {
promise.trigger('promise:resolved', { detail: value }); promise.trigger('promise:resolved', { detail: value });
promise.isResolved = true; promise.isResolved = true;
promise.resolvedValue = value; promise.resolvedValue = value;
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
} }
function reject(promise, value) { function reject(promise, value) {
rsvp.async(function() { RSVP.async(function() {
promise.trigger('promise:failed', { detail: value }); promise.trigger('promise:failed', { detail: value });
promise.isRejected = true; promise.isRejected = true;
promise.rejectedValue = value; promise.rejectedValue = value;
......
(function(a){function q(a,b){rsvp.async(function(){a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedValue=b})}function p(a,b){rsvp.async(function(){a.trigger("promise:resolved",{detail:b}),a.isResolved=!0,a.resolvedValue=b})}"use strict";var b=typeof window!="undefined"?window:{},c=b.MutationObserver||b.WebKitMutationObserver,d,e;if(typeof process!="undefined"&&{}.toString.call(process)==="[object process]")e=function(a,b){process.nextTick(function(){a.call(b)})};else if(c){var f=[],g=new c(function(){var a=f.slice();f=[],a.forEach(function(a){var b=a[0],c=a[1];b.call(c)})}),h=document.createElement("div");g.observe(h,{attributes:!0}),e=function(a,b){f.push([a,b]),h.setAttribute("drainQueue","drainQueue")}}else e=function(a,b){setTimeout(function(){a.call(b)},1)};var i=function(a,b){this.type=a;for(var c in b){if(!b.hasOwnProperty(c))continue;this[c]=b[c]}},j=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c][0]===b)return c;return-1},k=function(a){var b=a._promiseCallbacks;b||(b=a._promiseCallbacks={});return b},l={mixin:function(a){a.on=this.on,a.off=this.off,a.trigger=this.trigger;return a},on:function(a,b,c){var d=k(this),e,f;a=a.split(/\s+/),c=c||this;while(f=a.shift())e=d[f],e||(e=d[f]=[]),j(e,b)===-1&&e.push([b,c])},off:function(a,b){var c=k(this),d,e,f;a=a.split(/\s+/);while(e=a.shift()){if(!b){c[e]=[];continue}d=c[e],f=j(d,b),f!==-1&&d.splice(f,1)}},trigger:function(a,b){var c=k(this),d,e,f,g,h;if(d=c[a])for(var j=0,l=d.length;j<l;j++)e=d[j],f=e[0],g=e[1],typeof b!="object"&&(b={detail:b}),h=new i(a,b),f.call(g,h)}},m=function(){this.on("promise:resolved",function(a){this.trigger("success",{detail:a.detail})},this),this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this)},n=function(){},o=function(a,b,c,d){var e,f;if(c)try{e=c(d.detail)}catch(g){f=g}else e=d.detail;e instanceof m?e.then(function(a){b.resolve(a)},function(a){b.reject(a)}):c&&e?b.resolve(e):f?b.reject(f):b[a](e)};m.prototype={then:function(a,b){var c=new m;this.isResolved&&rsvp.async(function(){o("resolve",c,a,{detail:this.resolvedValue})},this),this.isRejected&&rsvp.async(function(){o("reject",c,b,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(b){o("resolve",c,a,b)}),this.on("promise:failed",function(a){o("reject",c,b,a)});return c},resolve:function(a){p(this,a),this.resolve=n,this.reject=n},reject:function(a){q(this,a),this.resolve=n,this.reject=n}},l.mixin(m.prototype),d={async:e,Promise:m,Event:i,EventTarget:l},a.RSVP=d})(window)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment