Comparing version 3.6.1 to 3.6.2
@@ -1,1 +0,1 @@ | ||
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.RSVP=t.RSVP||{})})(this,function(t){"use strict";function e(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function r(t){var e=t._promiseCallbacks;e||(e=t._promiseCallbacks={});return e}function n(t,e){if(2!==arguments.length)return Tt[t];Tt[t]=e}function o(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function i(t){return"function"==typeof t}function u(t){return null!==t&&"object"==typeof t}function a(t){return null!==t&&"object"==typeof t}function s(){setTimeout(function(){for(var t=0;t<Pt.length;t++){var e=Pt[t],r=e.payload;r.guid=r.key+r.id;r.childGuid=r.key+r.childId;r.error&&(r.stack=r.error.stack);Tt.trigger(e.name,e.payload)}Pt.length=0},50)}function c(t,e,r){1===Pt.push({name:t,payload:{key:e._guidKey,id:e._id,eventName:t,detail:e._result,childId:r&&r._id,label:e._label,timeStamp:At(),error:Tt["instrument-with-stack"]?new Error(e._label):null}})&&s()}function f(t,e){var r=this;if(t&&"object"==typeof t&&t.constructor===r)return t;var n=new r(h,e);m(n,t);return n}function l(){return new TypeError("A promises callback cannot return that same promise.")}function h(){}function p(t){try{return t.then}catch(e){Mt.error=e;return Mt}}function y(t,e,r,n){try{t.call(e,r,n)}catch(o){return o}}function v(t,e,r){Tt.async(function(t){var n=!1,o=y(r,e,function(r){if(!n){n=!0;e!==r?m(t,r,void 0):b(t,r)}},function(e){if(!n){n=!0;g(t,e)}},"Settle: "+(t._label||" unknown promise"));if(!n&&o){n=!0;g(t,o)}},t)}function d(t,e){if(e._state===kt)b(t,e._result);else if(e._state===xt){e._onError=null;g(t,e._result)}else j(e,void 0,function(r){e!==r?m(t,r,void 0):b(t,r)},function(e){return g(t,e)})}function _(t,e,r){var n=e.constructor===t.constructor&&r===P&&t.constructor.resolve===f;if(n)d(t,e);else if(r===Mt){g(t,Mt.error);Mt.error=null}else i(r)?v(t,e,r):b(t,e)}function m(t,e){t===e?b(t,e):o(e)?_(t,e,p(e)):b(t,e)}function w(t){t._onError&&t._onError(t._result);E(t)}function b(t,e){if(t._state===Rt){t._result=e;t._state=kt;0===t._subscribers.length?Tt.instrument&&c("fulfilled",t):Tt.async(E,t)}}function g(t,e){if(t._state===Rt){t._state=xt;t._result=e;Tt.async(w,t)}}function j(t,e,r,n){var o=t._subscribers,i=o.length;t._onError=null;o[i]=e;o[i+kt]=r;o[i+xt]=n;0===i&&t._state&&Tt.async(E,t)}function E(t){var e=t._subscribers,r=t._state;Tt.instrument&&c(r===kt?"fulfilled":"rejected",t);if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3){n=e[u];o=e[u+r];n?S(r,n,o,i):o(i)}t._subscribers.length=0}}function T(){this.error=null}function O(t,e){try{return t(e)}catch(r){Ct.error=r;return Ct}}function S(t,e,r,n){var o=i(r),u=void 0,a=void 0;if(o){u=O(r,n);if(u===Ct){a=u.error;u.error=null}else if(u===e){g(e,l());return}}else u=n;e._state!==Rt||(o&&void 0===a?m(e,u):void 0!==a?g(e,a):t===kt?b(e,u):t===xt&&g(e,u))}function A(t,e){var r=!1;try{e(function(e){if(!r){r=!0;m(t,e)}},function(e){if(!r){r=!0;g(t,e)}})}catch(n){g(t,n)}}function P(t,e,r){var n=this,o=n._state;if(o===kt&&!t||o===xt&&!e){Tt.instrument&&c("chained",n,n);return n}n._onError=null;var i=new n.constructor(h,r),u=n._result;Tt.instrument&&c("chained",n,i);if(o===Rt)j(n,i,t,e);else{var a=o===kt?t:e;Tt.async(function(){return S(o,i,a,u)})}return i}function R(t,e,r,n){this._instanceConstructor=t;this.promise=new t(h,n);this._abortOnReject=r;this._init.apply(this,arguments)}function k(t,e,r){return t===kt?{state:"fulfilled",value:r}:{state:"rejected",reason:r}}function x(t,e){return St(t)?new R(this,t,(!0),e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)}function M(t,e){var r=this,n=new r(h,e);if(!St(t)){g(n,new TypeError("Promise.race must be called with an array"));return n}for(var o=0;n._state===Rt&&o<t.length;o++)j(r.resolve(t[o]),void 0,function(t){return m(n,t)},function(t){return g(n,t)});return n}function C(t,e){var r=this,n=new r(h,e);g(n,t);return n}function I(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function V(t,e){this._id=Nt++;this._label=e;this._state=void 0;this._result=void 0;this._subscribers=[];Tt.instrument&&c("created",this);if(h!==t){"function"!=typeof t&&I();this instanceof V?A(this,t):N()}}function D(){this.value=void 0}function K(t){try{return t.then}catch(e){Vt.value=e;return Vt}}function U(t,e,r){try{t.apply(e,r)}catch(n){Vt.value=n;return Vt}}function q(t,e){for(var r={},n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=t[i];for(var u=0;u<e.length;u++){var a=e[u];r[a]=o[u+1]}return r}function F(t){for(var e=t.length,r=new Array(e-1),n=1;n<e;n++)r[n-1]=t[n];return r}function G(t,e){return{then:function(r,n){return t.call(e,r,n)}}}function L(t,e){var r=function(){for(var r=this,n=arguments.length,o=new Array(n+1),i=!1,u=0;u<n;++u){var a=arguments[u];if(!i){i=$(a);if(i===Dt){var s=new V(h);g(s,Dt.value);return s}i&&i!==!0&&(a=G(i,a))}o[u]=a}var c=new V(h);o[n]=function(t,r){t?g(c,t):void 0===e?m(c,r):e===!0?m(c,F(arguments)):St(e)?m(c,q(arguments,e)):m(c,r)};return i?Y(c,o,t,r):W(c,o,t,r)};r.__proto__=t;return r}function W(t,e,r,n){var o=U(r,n,e);o===Vt&&g(t,o.value);return t}function Y(t,e,r,n){return V.all(e).then(function(e){var o=U(r,n,e);o===Vt&&g(t,o.value);return t})}function $(t){return!(!t||"object"!=typeof t)&&(t.constructor===V||K(t))}function z(t,e){return V.all(t,e)}function B(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function H(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function J(t,e){return St(t)?new Kt(V,t,e).promise:V.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function Q(t,e){return V.race(t,e)}function X(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Z(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function tt(t,e){return u(t)?new qt(V,t,e).promise:V.reject(new TypeError("Promise.hash must be called with an object"),e)}function et(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function rt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function nt(t,e){return u(t)?new Ft(V,t,(!1),e).promise:V.reject(new TypeError("RSVP.hashSettled must be called with an object"),e)}function ot(t){setTimeout(function(){throw t});throw t}function it(t){var e={resolve:void 0,reject:void 0};e.promise=new V(function(t,r){e.resolve=t;e.reject=r},t);return e}function ut(t,e,r){return St(t)?i(e)?V.all(t,r).then(function(t){for(var n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=e(t[i]);return V.all(o,r)}):V.reject(new TypeError("RSVP.map expects a function as a second argument"),r):V.reject(new TypeError("RSVP.map must be called with an array"),r)}function at(t,e){return V.resolve(t,e)}function st(t,e){return V.reject(t,e)}function ct(t,e){return V.all(t,e)}function ft(t,e){return V.resolve(t,e).then(function(t){return ct(t,e)})}function lt(t,e,r){if(!(St(t)||u(t)&&void 0!==t.then))return V.reject(new TypeError("RSVP.filter must be called with an array or promise"),r);if(!i(e))return V.reject(new TypeError("RSVP.filter expects function as a second argument"),r);var n=St(t)?ct(t,r):ft(t,r);return n.then(function(t){for(var n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=e(t[i]);return ct(o,r).then(function(e){for(var r=new Array(n),o=0,i=0;i<n;i++)if(e[i]){r[o]=t[i];o++}r.length=o;return r})})}function ht(t,e){Ht[Gt]=t;Ht[Gt+1]=e;Gt+=2;2===Gt&&Jt()}function pt(){var t=process.nextTick,e=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);Array.isArray(e)&&"0"===e[1]&&"10"===e[2]&&(t=setImmediate);return function(){return t(mt)}}function yt(){return"undefined"!=typeof Lt?function(){Lt(mt)}:_t()}function vt(){var t=0,e=new $t(mt),r=document.createTextNode("");e.observe(r,{characterData:!0});return function(){return r.data=t=++t%2}}function dt(){var t=new MessageChannel;t.port1.onmessage=mt;return function(){return t.port2.postMessage(0)}}function _t(){return function(){return setTimeout(mt,1)}}function mt(){for(var t=0;t<Gt;t+=2){var e=Ht[t],r=Ht[t+1];e(r);Ht[t]=void 0;Ht[t+1]=void 0}Gt=0}function wt(){try{var t=require,e=t("vertx");Lt=e.runOnLoop||e.runOnContext;return yt()}catch(r){return _t()}}function bt(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r;return t}function gt(){Tt.on.apply(Tt,arguments)}function jt(){Tt.off.apply(Tt,arguments)}var Et={mixin:function(t){t.on=this.on;t.off=this.off;t.trigger=this.trigger;t._promiseCallbacks=void 0;return t},on:function(t,n){if("function"!=typeof n)throw new TypeError("Callback must be a function");var o=r(this),i=void 0;i=o[t];i||(i=o[t]=[]);e(i,n)===-1&&i.push(n)},off:function(t,n){var o=r(this),i=void 0,u=void 0;if(n){i=o[t];u=e(i,n);u!==-1&&i.splice(u,1)}else o[t]=[]},trigger:function(t,e,n){var o=r(this),i=void 0,u=void 0;if(i=o[t])for(var a=0;a<i.length;a++){u=i[a];u(e,n)}}},Tt={instrument:!1};Et.mixin(Tt);var Ot=void 0;Ot=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var St=Ot,At=Date.now||function(){return(new Date).getTime()},Pt=[],Rt=void 0,kt=1,xt=2,Mt=new T,Ct=new T;R.prototype._init=function(t,e){var r=e.length||0;this.length=r;this._remaining=r;this._result=new Array(r);this._enumerate(e);0===this._remaining&&b(this.promise,this._result)};R.prototype._enumerate=function(t){for(var e=this.length,r=this.promise,n=0;r._state===Rt&&n<e;n++)this._eachEntry(t[n],n)};R.prototype._settleMaybeThenable=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===f){var o=p(t);if(o===P&&t._state!==Rt){t._onError=null;this._settledAt(t._state,e,t._result)}else if("function"!=typeof o){this._remaining--;this._result[e]=this._makeResult(kt,e,t)}else if(r===V){var i=new r(h);_(i,t,o);this._willSettleAt(i,e)}else this._willSettleAt(new r(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)};R.prototype._eachEntry=function(t,e){if(a(t))this._settleMaybeThenable(t,e);else{this._remaining--;this._result[e]=this._makeResult(kt,e,t)}};R.prototype._settledAt=function(t,e,r){var n=this.promise;if(n._state===Rt)if(this._abortOnReject&&t===xt)g(n,r);else{this._remaining--;this._result[e]=this._makeResult(t,e,r);0===this._remaining&&b(n,this._result)}};R.prototype._makeResult=function(t,e,r){return r};R.prototype._willSettleAt=function(t,e){var r=this;j(t,void 0,function(t){return r._settledAt(kt,e,t)},function(t){return r._settledAt(xt,e,t)})};var It="rsvp_"+At()+"-",Nt=0;V.prototype._onError=function(t){var e=this;Tt.after(function(){e._onError&&Tt.trigger("error",t,e._label)})};V.prototype["catch"]=function(t,e){return this.then(void 0,t,e)};V.prototype["finally"]=function(t,e){var r=this,n=r.constructor;return r.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})},e)};V.cast=f;V.all=x;V.race=M;V.resolve=f;V.reject=C;V.prototype._guidKey=It;V.prototype.then=P;var Vt=new D,Dt=new D,Kt=function(t){function e(e,r,n){return B(this,t.call(this,e,r,!1,n))}H(e,t);return e}(R);Kt.prototype._makeResult=k;var Ut=Object.prototype.hasOwnProperty,qt=function(t){function e(e,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments[3];return X(this,t.call(this,e,r,n,o))}Z(e,t);e.prototype._init=function(t,e){this._result={};this._enumerate(e);0===this._remaining&&b(this.promise,this._result)};e.prototype._enumerate=function(t){var e=this.promise,r=[];for(var n in t)Ut.call(t,n)&&r.push({position:n,entry:t[n]});var o=r.length;this._remaining=o;for(var i=void 0,u=0;e._state===Rt&&u<o;u++){i=r[u];this._eachEntry(i.entry,i.position)}};return e}(R),Ft=function(t){function e(e,r,n){return et(this,t.call(this,e,r,!1,n))}rt(e,t);return e}(qt);Ft.prototype._makeResult=k;var Gt=0,Lt=void 0,Wt="undefined"!=typeof window?window:void 0,Yt=Wt||{},$t=Yt.MutationObserver||Yt.WebKitMutationObserver,zt="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Bt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Ht=new Array(1e3),Jt=void 0;Jt=zt?pt():$t?vt():Bt?dt():void 0===Wt&&"function"==typeof require?wt():_t();var Qt=void 0;if("object"==typeof self)Qt=self;else{if("object"!=typeof global)throw new Error("no global: `self` or `global` found");Qt=global}var Xt;Tt.async=ht;Tt.after=function(t){return setTimeout(t,0)};var Zt=at,te=function(t,e){return Tt.async(t,e)};if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var ee=window.__PROMISE_INSTRUMENTATION__;n("instrument",!0);for(var re in ee)ee.hasOwnProperty(re)&>(re,ee[re])}var ne=(Xt={asap:ht,cast:Zt,Promise:V,EventTarget:Et,all:z,allSettled:J,race:Q,hash:tt,hashSettled:nt,rethrow:ot,defer:it,denodeify:L,configure:n,on:gt,off:jt,resolve:at,reject:st,map:ut},bt(Xt,"async",te),bt(Xt,"filter",lt),Xt);t["default"]=ne;t.asap=ht;t.cast=Zt;t.Promise=V;t.EventTarget=Et;t.all=z;t.allSettled=J;t.race=Q;t.hash=tt;t.hashSettled=nt;t.rethrow=ot;t.defer=it;t.denodeify=L;t.configure=n;t.on=gt;t.off=jt;t.resolve=at;t.reject=st;t.map=ut;t.async=te;t.filter=lt;Object.defineProperty(t,"__esModule",{value:!0})}); | ||
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.RSVP=t.RSVP||{})})(this,function(t){"use strict";function e(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function r(t){var e=t._promiseCallbacks;e||(e=t._promiseCallbacks={});return e}function n(t,e){if(2!==arguments.length)return jt[t];jt[t]=e}function o(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function i(t){return"function"==typeof t}function u(t){return null!==t&&"object"==typeof t}function a(t){return null!==t&&"object"==typeof t}function s(){setTimeout(function(){for(var t=0;t<St.length;t++){var e=St[t],r=e.payload;r.guid=r.key+r.id;r.childGuid=r.key+r.childId;r.error&&(r.stack=r.error.stack);jt.trigger(e.name,e.payload)}St.length=0},50)}function c(t,e,r){1===St.push({name:t,payload:{key:e._guidKey,id:e._id,eventName:t,detail:e._result,childId:r&&r._id,label:e._label,timeStamp:Ot(),error:jt["instrument-with-stack"]?new Error(e._label):null}})&&s()}function f(t,e){var r=this;if(t&&"object"==typeof t&&t.constructor===r)return t;var n=new r(h,e);m(n,t);return n}function l(){return new TypeError("A promises callback cannot return that same promise.")}function h(){}function p(t){try{return t.then}catch(e){kt.error=e;return kt}}function y(t,e,r,n){try{t.call(e,r,n)}catch(o){return o}}function v(t,e,r){jt.async(function(t){var n=!1,o=y(r,e,function(r){if(!n){n=!0;e!==r?m(t,r,void 0):b(t,r)}},function(e){if(!n){n=!0;g(t,e)}},"Settle: "+(t._label||" unknown promise"));if(!n&&o){n=!0;g(t,o)}},t)}function d(t,e){if(e._state===Pt)b(t,e._result);else if(e._state===Rt){e._onError=null;g(t,e._result)}else j(e,void 0,function(r){e!==r?m(t,r,void 0):b(t,r)},function(e){return g(t,e)})}function _(t,e,r){var n=e.constructor===t.constructor&&r===P&&t.constructor.resolve===f;if(n)d(t,e);else if(r===kt){g(t,kt.error);kt.error=null}else i(r)?v(t,e,r):b(t,e)}function m(t,e){t===e?b(t,e):o(e)?_(t,e,p(e)):b(t,e)}function w(t){t._onError&&t._onError(t._result);E(t)}function b(t,e){if(t._state===At){t._result=e;t._state=Pt;0===t._subscribers.length?jt.instrument&&c("fulfilled",t):jt.async(E,t)}}function g(t,e){if(t._state===At){t._state=Rt;t._result=e;jt.async(w,t)}}function j(t,e,r,n){var o=t._subscribers,i=o.length;t._onError=null;o[i]=e;o[i+Pt]=r;o[i+Rt]=n;0===i&&t._state&&jt.async(E,t)}function E(t){var e=t._subscribers,r=t._state;jt.instrument&&c(r===Pt?"fulfilled":"rejected",t);if(0!==e.length){for(var n=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3){n=e[u];o=e[u+r];n?S(r,n,o,i):o(i)}t._subscribers.length=0}}function T(){this.error=null}function O(t,e){try{return t(e)}catch(r){xt.error=r;return xt}}function S(t,e,r,n){var o=i(r),u=void 0,a=void 0;if(o){u=O(r,n);if(u===xt){a=u.error;u.error=null}else if(u===e){g(e,l());return}}else u=n;e._state!==At||(o&&void 0===a?m(e,u):void 0!==a?g(e,a):t===Pt?b(e,u):t===Rt&&g(e,u))}function A(t,e){var r=!1;try{e(function(e){if(!r){r=!0;m(t,e)}},function(e){if(!r){r=!0;g(t,e)}})}catch(n){g(t,n)}}function P(t,e,r){var n=this,o=n._state;if(o===Pt&&!t||o===Rt&&!e){jt.instrument&&c("chained",n,n);return n}n._onError=null;var i=new n.constructor(h,r),u=n._result;jt.instrument&&c("chained",n,i);if(o===At)j(n,i,t,e);else{var a=o===Pt?t:e;jt.async(function(){return S(o,i,a,u)})}return i}function R(t,e,r){return t===Pt?{state:"fulfilled",value:r}:{state:"rejected",reason:r}}function k(t,e){return Tt(t)?new Mt(this,t,(!0),e).promise:this.reject(new TypeError("Promise.all must be called with an array"),e)}function x(t,e){var r=this,n=new r(h,e);if(!Tt(t)){g(n,new TypeError("Promise.race must be called with an array"));return n}for(var o=0;n._state===At&&o<t.length;o++)j(r.resolve(t[o]),void 0,function(t){return m(n,t)},function(t){return g(n,t)});return n}function M(t,e){var r=this,n=new r(h,e);g(n,t);return n}function C(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function I(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(){this.value=void 0}function V(t){try{return t.then}catch(e){Vt.value=e;return Vt}}function D(t,e,r){try{t.apply(e,r)}catch(n){Vt.value=n;return Vt}}function K(t,e){for(var r={},n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=t[i];for(var u=0;u<e.length;u++){var a=e[u];r[a]=o[u+1]}return r}function U(t){for(var e=t.length,r=new Array(e-1),n=1;n<e;n++)r[n-1]=t[n];return r}function q(t,e){return{then:function(r,n){return t.call(e,r,n)}}}function F(t,e){var r=function(){for(var r=this,n=arguments.length,o=new Array(n+1),i=!1,u=0;u<n;++u){var a=arguments[u];if(!i){i=W(a);if(i===Dt){var s=new Nt(h);g(s,Dt.value);return s}i&&i!==!0&&(a=q(i,a))}o[u]=a}var c=new Nt(h);o[n]=function(t,r){t?g(c,t):void 0===e?m(c,r):e===!0?m(c,U(arguments)):Tt(e)?m(c,K(arguments,e)):m(c,r)};return i?L(c,o,t,r):G(c,o,t,r)};r.__proto__=t;return r}function G(t,e,r,n){var o=D(r,n,e);o===Vt&&g(t,o.value);return t}function L(t,e,r,n){return Nt.all(e).then(function(e){var o=D(r,n,e);o===Vt&&g(t,o.value);return t})}function W(t){return!(!t||"object"!=typeof t)&&(t.constructor===Nt||V(t))}function Y(t,e){return Nt.all(t,e)}function $(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function z(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function B(t,e){return Tt(t)?new Kt(Nt,t,e).promise:Nt.reject(new TypeError("Promise.allSettled must be called with an array"),e)}function H(t,e){return Nt.race(t,e)}function J(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function Q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function X(t,e){return u(t)?new qt(Nt,t,e).promise:Nt.reject(new TypeError("Promise.hash must be called with an object"),e)}function Z(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function tt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function et(t,e){return u(t)?new Ft(Nt,t,(!1),e).promise:Nt.reject(new TypeError("RSVP.hashSettled must be called with an object"),e)}function rt(t){setTimeout(function(){throw t});throw t}function nt(t){var e={resolve:void 0,reject:void 0};e.promise=new Nt(function(t,r){e.resolve=t;e.reject=r},t);return e}function ot(t,e,r){return Tt(t)?i(e)?Nt.all(t,r).then(function(t){for(var n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=e(t[i]);return Nt.all(o,r)}):Nt.reject(new TypeError("RSVP.map expects a function as a second argument"),r):Nt.reject(new TypeError("RSVP.map must be called with an array"),r)}function it(t,e){return Nt.resolve(t,e)}function ut(t,e){return Nt.reject(t,e)}function at(t,e){return Nt.all(t,e)}function st(t,e){return Nt.resolve(t,e).then(function(t){return at(t,e)})}function ct(t,e,r){if(!(Tt(t)||u(t)&&void 0!==t.then))return Nt.reject(new TypeError("RSVP.filter must be called with an array or promise"),r);if(!i(e))return Nt.reject(new TypeError("RSVP.filter expects function as a second argument"),r);var n=Tt(t)?at(t,r):st(t,r);return n.then(function(t){for(var n=t.length,o=new Array(n),i=0;i<n;i++)o[i]=e(t[i]);return at(o,r).then(function(e){for(var r=new Array(n),o=0,i=0;i<n;i++)if(e[i]){r[o]=t[i];o++}r.length=o;return r})})}function ft(t,e){Ht[Gt]=t;Ht[Gt+1]=e;Gt+=2;2===Gt&&Jt()}function lt(){var t=process.nextTick,e=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);Array.isArray(e)&&"0"===e[1]&&"10"===e[2]&&(t=setImmediate);return function(){return t(dt)}}function ht(){return"undefined"!=typeof Lt?function(){Lt(dt)}:vt()}function pt(){var t=0,e=new $t(dt),r=document.createTextNode("");e.observe(r,{characterData:!0});return function(){return r.data=t=++t%2}}function yt(){var t=new MessageChannel;t.port1.onmessage=dt;return function(){return t.port2.postMessage(0)}}function vt(){return function(){return setTimeout(dt,1)}}function dt(){for(var t=0;t<Gt;t+=2){var e=Ht[t],r=Ht[t+1];e(r);Ht[t]=void 0;Ht[t+1]=void 0}Gt=0}function _t(){try{var t=require,e=t("vertx");Lt=e.runOnLoop||e.runOnContext;return ht()}catch(r){return vt()}}function mt(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r;return t}function wt(){jt.on.apply(jt,arguments)}function bt(){jt.off.apply(jt,arguments)}var gt={mixin:function(t){t.on=this.on;t.off=this.off;t.trigger=this.trigger;t._promiseCallbacks=void 0;return t},on:function(t,n){if("function"!=typeof n)throw new TypeError("Callback must be a function");var o=r(this),i=void 0;i=o[t];i||(i=o[t]=[]);e(i,n)===-1&&i.push(n)},off:function(t,n){var o=r(this),i=void 0,u=void 0;if(n){i=o[t];u=e(i,n);u!==-1&&i.splice(u,1)}else o[t]=[]},trigger:function(t,e,n){var o=r(this),i=void 0,u=void 0;if(i=o[t])for(var a=0;a<i.length;a++){u=i[a];u(e,n)}}},jt={instrument:!1};gt.mixin(jt);var Et=void 0;Et=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var Tt=Et,Ot=Date.now||function(){return(new Date).getTime()},St=[],At=void 0,Pt=1,Rt=2,kt=new T,xt=new T,Mt=function(){function t(t,e,r,n){this._instanceConstructor=t;this.promise=new t(h,n);this._abortOnReject=r;this._init.apply(this,arguments)}t.prototype._init=function(t,e){var r=e.length||0;this.length=r;this._remaining=r;this._result=new Array(r);this._enumerate(e);0===this._remaining&&b(this.promise,this._result)};t.prototype._enumerate=function(t){for(var e=this.length,r=this.promise,n=0;r._state===At&&n<e;n++)this._eachEntry(t[n],n)};t.prototype._settleMaybeThenable=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===f){var o=p(t);if(o===P&&t._state!==At){t._onError=null;this._settledAt(t._state,e,t._result)}else if("function"!=typeof o){this._remaining--;this._result[e]=this._makeResult(Pt,e,t)}else if(r===Nt){var i=new r(h);_(i,t,o);this._willSettleAt(i,e)}else this._willSettleAt(new r(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)};t.prototype._eachEntry=function(t,e){if(a(t))this._settleMaybeThenable(t,e);else{this._remaining--;this._result[e]=this._makeResult(Pt,e,t)}};t.prototype._settledAt=function(t,e,r){var n=this.promise;if(n._state===At)if(this._abortOnReject&&t===Rt)g(n,r);else{this._remaining--;this._result[e]=this._makeResult(t,e,r);0===this._remaining&&b(n,this._result)}};t.prototype._makeResult=function(t,e,r){return r};t.prototype._willSettleAt=function(t,e){var r=this;j(t,void 0,function(t){return r._settledAt(Pt,e,t)},function(t){return r._settledAt(Rt,e,t)})};return t}(),Ct="rsvp_"+Ot()+"-",It=0,Nt=function(){function t(e,r){this._id=It++;this._label=r;this._state=void 0;this._result=void 0;this._subscribers=[];jt.instrument&&c("created",this);if(h!==e){"function"!=typeof e&&C();this instanceof t?A(this,e):I()}}t.prototype._onError=function(t){var e=this;jt.after(function(){e._onError&&jt.trigger("error",t,e._label)})};t.prototype["catch"]=function(t,e){return this.then(void 0,t,e)};t.prototype["finally"]=function(t,e){var r=this,n=r.constructor;return r.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})},e)};return t}();Nt.cast=f;Nt.all=k;Nt.race=x;Nt.resolve=f;Nt.reject=M;Nt.prototype._guidKey=Ct;Nt.prototype.then=P;var Vt=new N,Dt=new N,Kt=function(t){function e(e,r,n){return $(this,t.call(this,e,r,!1,n))}z(e,t);return e}(Mt);Kt.prototype._makeResult=R;var Ut=Object.prototype.hasOwnProperty,qt=function(t){function e(e,r){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments[3];return J(this,t.call(this,e,r,n,o))}Q(e,t);e.prototype._init=function(t,e){this._result={};this._enumerate(e);0===this._remaining&&b(this.promise,this._result)};e.prototype._enumerate=function(t){var e=this.promise,r=[];for(var n in t)Ut.call(t,n)&&r.push({position:n,entry:t[n]});var o=r.length;this._remaining=o;for(var i=void 0,u=0;e._state===At&&u<o;u++){i=r[u];this._eachEntry(i.entry,i.position)}};return e}(Mt),Ft=function(t){function e(e,r,n){return Z(this,t.call(this,e,r,!1,n))}tt(e,t);return e}(qt);Ft.prototype._makeResult=R;var Gt=0,Lt=void 0,Wt="undefined"!=typeof window?window:void 0,Yt=Wt||{},$t=Yt.MutationObserver||Yt.WebKitMutationObserver,zt="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Bt="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Ht=new Array(1e3),Jt=void 0;Jt=zt?lt():$t?pt():Bt?yt():void 0===Wt&&"function"==typeof require?_t():vt();var Qt=void 0;if("object"==typeof self)Qt=self;else{if("object"!=typeof global)throw new Error("no global: `self` or `global` found");Qt=global}var Xt;jt.async=ft;jt.after=function(t){return setTimeout(t,0)};var Zt=it,te=function(t,e){return jt.async(t,e)};if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){var ee=window.__PROMISE_INSTRUMENTATION__;n("instrument",!0);for(var re in ee)ee.hasOwnProperty(re)&&wt(re,ee[re])}var ne=(Xt={asap:ft,cast:Zt,Promise:Nt,EventTarget:gt,all:Y,allSettled:B,race:H,hash:X,hashSettled:et,rethrow:rt,defer:nt,denodeify:F,configure:n,on:wt,off:bt,resolve:it,reject:ut,map:ot},mt(Xt,"async",te),mt(Xt,"filter",ct),Xt);t["default"]=ne;t.asap=ft;t.cast=Zt;t.Promise=Nt;t.EventTarget=gt;t.all=Y;t.allSettled=B;t.race=H;t.hash=X;t.hashSettled=et;t.rethrow=rt;t.defer=nt;t.denodeify=F;t.configure=n;t.on=wt;t.off=bt;t.resolve=it;t.reject=ut;t.map=ot;t.async=te;t.filter=ct;Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -23,93 +23,95 @@ import { | ||
export default function Enumerator(Constructor, input, abortOnReject, label) { | ||
this._instanceConstructor = Constructor; | ||
this.promise = new Constructor(noop, label); | ||
this._abortOnReject = abortOnReject; | ||
export default class Enumerator { | ||
constructor(Constructor, input, abortOnReject, label) { | ||
this._instanceConstructor = Constructor; | ||
this.promise = new Constructor(noop, label); | ||
this._abortOnReject = abortOnReject; | ||
this._init(...arguments); | ||
} | ||
this._init(...arguments); | ||
} | ||
Enumerator.prototype._init = function(Constructor, input) { | ||
let len = input.length || 0; | ||
this.length = len; | ||
this._remaining = len; | ||
this._result = new Array(len); | ||
_init(Constructor, input) { | ||
let len = input.length || 0; | ||
this.length = len; | ||
this._remaining = len; | ||
this._result = new Array(len); | ||
this._enumerate(input); | ||
if (this._remaining === 0) { | ||
fulfill(this.promise, this._result); | ||
this._enumerate(input); | ||
if (this._remaining === 0) { | ||
fulfill(this.promise, this._result); | ||
} | ||
} | ||
} | ||
Enumerator.prototype._enumerate = function(input) { | ||
let length = this.length; | ||
let promise = this.promise; | ||
_enumerate(input) { | ||
let length = this.length; | ||
let promise = this.promise; | ||
for (let i = 0; promise._state === PENDING && i < length; i++) { | ||
this._eachEntry(input[i], i); | ||
for (let i = 0; promise._state === PENDING && i < length; i++) { | ||
this._eachEntry(input[i], i); | ||
} | ||
} | ||
} | ||
Enumerator.prototype._settleMaybeThenable = function(entry, i) { | ||
let c = this._instanceConstructor; | ||
let resolve = c.resolve; | ||
_settleMaybeThenable(entry, i) { | ||
let c = this._instanceConstructor; | ||
let resolve = c.resolve; | ||
if (resolve === originalResolve) { | ||
let then = getThen(entry); | ||
if (resolve === originalResolve) { | ||
let then = getThen(entry); | ||
if (then === originalThen && entry._state !== PENDING) { | ||
entry._onError = null; | ||
this._settledAt(entry._state, i, entry._result); | ||
} else if (typeof then !== 'function') { | ||
this._remaining--; | ||
this._result[i] = this._makeResult(FULFILLED, i, entry); | ||
} else if (c === Promise) { | ||
let promise = new c(noop); | ||
handleMaybeThenable(promise, entry, then); | ||
this._willSettleAt(promise, i); | ||
if (then === originalThen && entry._state !== PENDING) { | ||
entry._onError = null; | ||
this._settledAt(entry._state, i, entry._result); | ||
} else if (typeof then !== 'function') { | ||
this._remaining--; | ||
this._result[i] = this._makeResult(FULFILLED, i, entry); | ||
} else if (c === Promise) { | ||
let promise = new c(noop); | ||
handleMaybeThenable(promise, entry, then); | ||
this._willSettleAt(promise, i); | ||
} else { | ||
this._willSettleAt(new c(resolve => resolve(entry)), i); | ||
} | ||
} else { | ||
this._willSettleAt(new c(resolve => resolve(entry)), i); | ||
this._willSettleAt(resolve(entry), i); | ||
} | ||
} else { | ||
this._willSettleAt(resolve(entry), i); | ||
} | ||
} | ||
Enumerator.prototype._eachEntry = function(entry, i) { | ||
if (isMaybeThenable(entry)) { | ||
this._settleMaybeThenable(entry, i); | ||
} else { | ||
this._remaining--; | ||
this._result[i] = this._makeResult(FULFILLED, i, entry); | ||
_eachEntry(entry, i) { | ||
if (isMaybeThenable(entry)) { | ||
this._settleMaybeThenable(entry, i); | ||
} else { | ||
this._remaining--; | ||
this._result[i] = this._makeResult(FULFILLED, i, entry); | ||
} | ||
} | ||
} | ||
Enumerator.prototype._settledAt = function(state, i, value) { | ||
let promise = this.promise; | ||
_settledAt(state, i, value) { | ||
let promise = this.promise; | ||
if (promise._state === PENDING) { | ||
if (this._abortOnReject && state === REJECTED) { | ||
reject(promise, value); | ||
} else { | ||
this._remaining--; | ||
this._result[i] = this._makeResult(state, i, value); | ||
if (this._remaining === 0) { | ||
fulfill(promise, this._result); | ||
if (promise._state === PENDING) { | ||
if (this._abortOnReject && state === REJECTED) { | ||
reject(promise, value); | ||
} else { | ||
this._remaining--; | ||
this._result[i] = this._makeResult(state, i, value); | ||
if (this._remaining === 0) { | ||
fulfill(promise, this._result); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
Enumerator.prototype._makeResult = function(state, i, value) { | ||
return value; | ||
} | ||
_makeResult(state, i, value) { | ||
return value; | ||
} | ||
Enumerator.prototype._willSettleAt = function(promise, i) { | ||
let enumerator = this; | ||
_willSettleAt(promise, i) { | ||
let enumerator = this; | ||
subscribe( | ||
promise, undefined, | ||
value => enumerator._settledAt(FULFILLED, i, value), | ||
reason => enumerator._settledAt(REJECTED, i, reason) | ||
); | ||
subscribe( | ||
promise, undefined, | ||
value => enumerator._settledAt(FULFILLED, i, value), | ||
reason => enumerator._settledAt(REJECTED, i, reason) | ||
); | ||
} | ||
} | ||
@@ -116,0 +118,0 @@ |
@@ -134,24 +134,25 @@ import { config } from './config'; | ||
*/ | ||
function Promise(resolver, label) { | ||
this._id = counter++; | ||
this._label = label; | ||
this._state = undefined; | ||
this._result = undefined; | ||
this._subscribers = []; | ||
class Promise { | ||
constructor(resolver, label) { | ||
this._id = counter++; | ||
this._label = label; | ||
this._state = undefined; | ||
this._result = undefined; | ||
this._subscribers = []; | ||
config.instrument && instrument('created', this); | ||
config.instrument && instrument('created', this); | ||
if (noop !== resolver) { | ||
typeof resolver !== 'function' && needsResolver(); | ||
this instanceof Promise ? initializePromise(this, resolver) : needsNew(); | ||
if (noop !== resolver) { | ||
typeof resolver !== 'function' && needsResolver(); | ||
this instanceof Promise ? initializePromise(this, resolver) : needsNew(); | ||
} | ||
} | ||
} | ||
Promise.prototype._onError = function(reason) { | ||
config.after(() => { | ||
if (this._onError) { | ||
config.trigger('error', reason, this._label); | ||
} | ||
}); | ||
} | ||
_onError(reason) { | ||
config.after(() => { | ||
if (this._onError) { | ||
config.trigger('error', reason, this._label); | ||
} | ||
}); | ||
} | ||
@@ -186,5 +187,5 @@ /** | ||
*/ | ||
Promise.prototype.catch = function(onRejection, label) { | ||
return this.then(undefined, onRejection, label); | ||
} | ||
catch(onRejection, label) { | ||
return this.then(undefined, onRejection, label); | ||
} | ||
@@ -231,12 +232,10 @@ /** | ||
*/ | ||
Promise.prototype.finally = function(callback, label) { | ||
let promise = this; | ||
let constructor = promise.constructor; | ||
finally(callback, label) { | ||
let promise = this; | ||
let constructor = promise.constructor; | ||
return promise.then( | ||
value => constructor.resolve(callback()).then(() => value), | ||
reason => constructor.resolve(callback()).then(() => { throw reason; }), | ||
label | ||
); | ||
} | ||
return promise.then(value => constructor.resolve(callback()).then(() => value), | ||
reason => constructor.resolve(callback()).then(() => { throw reason; }), label); | ||
} | ||
}; | ||
@@ -243,0 +242,0 @@ Promise.cast = Resolve; // deprecated |
{ | ||
"name": "rsvp", | ||
"namespace": "RSVP", | ||
"version": "3.6.1", | ||
"version": "3.6.2", | ||
"description": "A lightweight library that provides tools for organizing asynchronous code", | ||
@@ -6,0 +6,0 @@ "main": "dist/rsvp.js", |
@@ -1,2 +0,2 @@ | ||
# RSVP.js [![Build Status](https://secure.travis-ci.org/tildeio/rsvp.js.png?branch=master)](http://travis-ci.org/tildeio/rsvp.js) [![Inline docs](http://inch-ci.org/github/tildeio/rsvp.js.svg?branch=master)](http://inch-ci.org/github/tildeio/rsvp.js) | ||
# RSVP.js [![Build Status](https://secure.travis-ci.org/tildeio/rsvp.js.svg?branch=master)](http://travis-ci.org/tildeio/rsvp.js) [![Inline docs](http://inch-ci.org/github/tildeio/rsvp.js.svg?branch=master)](http://inch-ci.org/github/tildeio/rsvp.js) | ||
@@ -3,0 +3,0 @@ RSVP.js provides simple tools for organizing asynchronous code. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
750855
40
8368
5