diff options
Diffstat (limited to 'node_modules/promise/lib')
-rw-r--r-- | node_modules/promise/lib/core.js | 78 | ||||
-rw-r--r-- | node_modules/promise/lib/es6-extensions.js | 14 | ||||
-rw-r--r-- | node_modules/promise/lib/rejection-tracking.js | 28 | ||||
-rw-r--r-- | node_modules/promise/lib/synchronous.js | 20 |
4 files changed, 70 insertions, 70 deletions
diff --git a/node_modules/promise/lib/core.js b/node_modules/promise/lib/core.js index aefc987b6..2e575265b 100644 --- a/node_modules/promise/lib/core.js +++ b/node_modules/promise/lib/core.js @@ -58,16 +58,16 @@ function Promise(fn) { if (typeof fn !== 'function') { throw new TypeError('Promise constructor\'s argument is not a function'); } - this._40 = 0; - this._65 = 0; - this._55 = null; - this._72 = null; + this._75 = 0; + this._83 = 0; + this._18 = null; + this._38 = null; if (fn === noop) return; doResolve(fn, this); } -Promise._37 = null; -Promise._87 = null; -Promise._61 = noop; +Promise._47 = null; +Promise._71 = null; +Promise._44 = noop; Promise.prototype.then = function(onFulfilled, onRejected) { if (this.constructor !== Promise) { @@ -86,24 +86,24 @@ function safeThen(self, onFulfilled, onRejected) { }); } function handle(self, deferred) { - while (self._65 === 3) { - self = self._55; + while (self._83 === 3) { + self = self._18; } - if (Promise._37) { - Promise._37(self); + if (Promise._47) { + Promise._47(self); } - if (self._65 === 0) { - if (self._40 === 0) { - self._40 = 1; - self._72 = deferred; + if (self._83 === 0) { + if (self._75 === 0) { + self._75 = 1; + self._38 = deferred; return; } - if (self._40 === 1) { - self._40 = 2; - self._72 = [self._72, deferred]; + if (self._75 === 1) { + self._75 = 2; + self._38 = [self._38, deferred]; return; } - self._72.push(deferred); + self._38.push(deferred); return; } handleResolved(self, deferred); @@ -111,16 +111,16 @@ function handle(self, deferred) { function handleResolved(self, deferred) { asap(function() { - var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected; + var cb = self._83 === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { - if (self._65 === 1) { - resolve(deferred.promise, self._55); + if (self._83 === 1) { + resolve(deferred.promise, self._18); } else { - reject(deferred.promise, self._55); + reject(deferred.promise, self._18); } return; } - var ret = tryCallOne(cb, self._55); + var ret = tryCallOne(cb, self._18); if (ret === IS_ERROR) { reject(deferred.promise, LAST_ERROR); } else { @@ -148,8 +148,8 @@ function resolve(self, newValue) { then === self.then && newValue instanceof Promise ) { - self._65 = 3; - self._55 = newValue; + self._83 = 3; + self._18 = newValue; finale(self); return; } else if (typeof then === 'function') { @@ -157,29 +157,29 @@ function resolve(self, newValue) { return; } } - self._65 = 1; - self._55 = newValue; + self._83 = 1; + self._18 = newValue; finale(self); } function reject(self, newValue) { - self._65 = 2; - self._55 = newValue; - if (Promise._87) { - Promise._87(self, newValue); + self._83 = 2; + self._18 = newValue; + if (Promise._71) { + Promise._71(self, newValue); } finale(self); } function finale(self) { - if (self._40 === 1) { - handle(self, self._72); - self._72 = null; + if (self._75 === 1) { + handle(self, self._38); + self._38 = null; } - if (self._40 === 2) { - for (var i = 0; i < self._72.length; i++) { - handle(self, self._72[i]); + if (self._75 === 2) { + for (var i = 0; i < self._38.length; i++) { + handle(self, self._38[i]); } - self._72 = null; + self._38 = null; } } diff --git a/node_modules/promise/lib/es6-extensions.js b/node_modules/promise/lib/es6-extensions.js index 8ab266698..e6d92aa60 100644 --- a/node_modules/promise/lib/es6-extensions.js +++ b/node_modules/promise/lib/es6-extensions.js @@ -16,9 +16,9 @@ var ZERO = valuePromise(0); var EMPTYSTRING = valuePromise(''); function valuePromise(value) { - var p = new Promise(Promise._61); - p._65 = 1; - p._55 = value; + var p = new Promise(Promise._44); + p._83 = 1; + p._18 = value; return p; } Promise.resolve = function (value) { @@ -55,11 +55,11 @@ Promise.all = function (arr) { function res(i, val) { if (val && (typeof val === 'object' || typeof val === 'function')) { if (val instanceof Promise && val.then === Promise.prototype.then) { - while (val._65 === 3) { - val = val._55; + while (val._83 === 3) { + val = val._18; } - if (val._65 === 1) return res(i, val._55); - if (val._65 === 2) reject(val._55); + if (val._83 === 1) return res(i, val._18); + if (val._83 === 2) reject(val._18); val.then(function (val) { res(i, val); }, reject); diff --git a/node_modules/promise/lib/rejection-tracking.js b/node_modules/promise/lib/rejection-tracking.js index 10ccce306..11d7f3154 100644 --- a/node_modules/promise/lib/rejection-tracking.js +++ b/node_modules/promise/lib/rejection-tracking.js @@ -12,8 +12,8 @@ var enabled = false; exports.disable = disable; function disable() { enabled = false; - Promise._37 = null; - Promise._87 = null; + Promise._47 = null; + Promise._71 = null; } exports.enable = enable; @@ -24,27 +24,27 @@ function enable(options) { var id = 0; var displayId = 0; var rejections = {}; - Promise._37 = function (promise) { + Promise._47 = function (promise) { if ( - promise._65 === 2 && // IS REJECTED - rejections[promise._51] + promise._83 === 2 && // IS REJECTED + rejections[promise._56] ) { - if (rejections[promise._51].logged) { - onHandled(promise._51); + if (rejections[promise._56].logged) { + onHandled(promise._56); } else { - clearTimeout(rejections[promise._51].timeout); + clearTimeout(rejections[promise._56].timeout); } - delete rejections[promise._51]; + delete rejections[promise._56]; } }; - Promise._87 = function (promise, err) { - if (promise._40 === 0) { // not yet handled - promise._51 = id++; - rejections[promise._51] = { + Promise._71 = function (promise, err) { + if (promise._75 === 0) { // not yet handled + promise._56 = id++; + rejections[promise._56] = { displayId: null, error: err, timeout: setTimeout( - onUnhandled.bind(null, promise._51), + onUnhandled.bind(null, promise._56), // For reference errors and type errors, this almost always // means the programmer made a mistake, so log them after just // 100ms diff --git a/node_modules/promise/lib/synchronous.js b/node_modules/promise/lib/synchronous.js index 49399644b..93ee503c9 100644 --- a/node_modules/promise/lib/synchronous.js +++ b/node_modules/promise/lib/synchronous.js @@ -17,38 +17,38 @@ Promise.enableSynchronous = function () { }; Promise.prototype.getValue = function () { - if (this._65 === 3) { - return this._55.getValue(); + if (this._83 === 3) { + return this._18.getValue(); } if (!this.isFulfilled()) { throw new Error('Cannot get a value of an unfulfilled promise.'); } - return this._55; + return this._18; }; Promise.prototype.getReason = function () { - if (this._65 === 3) { - return this._55.getReason(); + if (this._83 === 3) { + return this._18.getReason(); } if (!this.isRejected()) { throw new Error('Cannot get a rejection reason of a non-rejected promise.'); } - return this._55; + return this._18; }; Promise.prototype.getState = function () { - if (this._65 === 3) { - return this._55.getState(); + if (this._83 === 3) { + return this._18.getState(); } - if (this._65 === -1 || this._65 === -2) { + if (this._83 === -1 || this._83 === -2) { return 0; } - return this._65; + return this._83; }; }; |