Comparing version 3.6.4 to 3.7.0
@@ -55,5 +55,5 @@ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
this._queue = new Array(1<<16); | ||
this._queue = this; | ||
this._queueLen = 0; | ||
this._afterQueue = new Array(1<<4); | ||
this._afterQueue = {}; | ||
this._afterQueueLen = 0; | ||
@@ -130,2 +130,3 @@ | ||
return function unhandledRejection(Promise) { | ||
var logError = noop; | ||
@@ -350,2 +351,3 @@ var logInfo = noop; | ||
var tasks = environment.scheduler; | ||
var emitRejection = initEmitRejection(); | ||
@@ -817,3 +819,4 @@ var objectCreate = Object.create || | ||
var q = this.consumers; | ||
var handler = this.join(); | ||
var handler = this.handler; | ||
this.handler = this.handler.join(); | ||
this.consumers = void 0; | ||
@@ -980,2 +983,4 @@ | ||
Rejected.prototype.fail = function(context) { | ||
this.reported = true; | ||
emitRejection('unhandledRejection', this); | ||
Promise.onFatalRejection(this, context === void 0 ? this.context : context); | ||
@@ -990,5 +995,6 @@ }; | ||
ReportTask.prototype.run = function() { | ||
if(!this.rejection.handled) { | ||
if(!this.rejection.handled && !this.rejection.reported) { | ||
this.rejection.reported = true; | ||
Promise.onPotentiallyUnhandledRejection(this.rejection, this.context); | ||
emitRejection('unhandledRejection', this.rejection) || | ||
Promise.onPotentiallyUnhandledRejection(this.rejection, this.context); | ||
} | ||
@@ -1003,3 +1009,4 @@ }; | ||
if(this.rejection.reported) { | ||
Promise.onPotentiallyUnhandledRejectionHandled(this.rejection); | ||
emitRejection('rejectionHandled', this.rejection) || | ||
Promise.onPotentiallyUnhandledRejectionHandled(this.rejection); | ||
} | ||
@@ -1011,3 +1018,2 @@ }; | ||
// TODO: Better names: "annotate"? | ||
Promise.createContext | ||
@@ -1225,2 +1231,41 @@ = Promise.enterContext | ||
function initEmitRejection() { | ||
/*global process, self, CustomEvent*/ | ||
if(typeof process !== 'undefined' && process !== null | ||
&& typeof process.emit === 'function') { | ||
// Returning falsy here means to call the default | ||
// onPotentiallyUnhandledRejection API. This is safe even in | ||
// browserify since process.emit always returns falsy in browserify: | ||
// https://github.com/defunctzombie/node-process/blob/master/browser.js#L40-L46 | ||
return function(type, rejection) { | ||
return type === 'unhandledRejection' | ||
? process.emit(type, rejection.value, rejection) | ||
: process.emit(type, rejection); | ||
}; | ||
} else if(typeof self !== 'undefined' && typeof CustomEvent === 'function') { | ||
return (function(noop, self, CustomEvent) { | ||
var hasCustomEvent = false; | ||
try { | ||
var ev = new CustomEvent('unhandledRejection'); | ||
hasCustomEvent = ev instanceof CustomEvent; | ||
} catch (e) {} | ||
return !hasCustomEvent ? noop : function(type, rejection) { | ||
var ev = new CustomEvent(type, { | ||
detail: { | ||
reason: rejection.value, | ||
key: rejection | ||
}, | ||
bubbles: false, | ||
cancelable: true | ||
}); | ||
return !self.dispatchEvent(ev); | ||
}; | ||
}(noop, self, CustomEvent)); | ||
} | ||
return noop; | ||
} | ||
return Promise; | ||
@@ -1227,0 +1272,0 @@ }; |
@@ -12,2 +12,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
return function unhandledRejection(Promise) { | ||
var logError = noop; | ||
@@ -14,0 +15,0 @@ var logInfo = noop; |
@@ -11,2 +11,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
var tasks = environment.scheduler; | ||
var emitRejection = initEmitRejection(); | ||
@@ -478,3 +479,4 @@ var objectCreate = Object.create || | ||
var q = this.consumers; | ||
var handler = this.join(); | ||
var handler = this.handler; | ||
this.handler = this.handler.join(); | ||
this.consumers = void 0; | ||
@@ -641,2 +643,4 @@ | ||
Rejected.prototype.fail = function(context) { | ||
this.reported = true; | ||
emitRejection('unhandledRejection', this); | ||
Promise.onFatalRejection(this, context === void 0 ? this.context : context); | ||
@@ -651,5 +655,6 @@ }; | ||
ReportTask.prototype.run = function() { | ||
if(!this.rejection.handled) { | ||
if(!this.rejection.handled && !this.rejection.reported) { | ||
this.rejection.reported = true; | ||
Promise.onPotentiallyUnhandledRejection(this.rejection, this.context); | ||
emitRejection('unhandledRejection', this.rejection) || | ||
Promise.onPotentiallyUnhandledRejection(this.rejection, this.context); | ||
} | ||
@@ -664,3 +669,4 @@ }; | ||
if(this.rejection.reported) { | ||
Promise.onPotentiallyUnhandledRejectionHandled(this.rejection); | ||
emitRejection('rejectionHandled', this.rejection) || | ||
Promise.onPotentiallyUnhandledRejectionHandled(this.rejection); | ||
} | ||
@@ -672,3 +678,2 @@ }; | ||
// TODO: Better names: "annotate"? | ||
Promise.createContext | ||
@@ -886,2 +891,41 @@ = Promise.enterContext | ||
function initEmitRejection() { | ||
/*global process, self, CustomEvent*/ | ||
if(typeof process !== 'undefined' && process !== null | ||
&& typeof process.emit === 'function') { | ||
// Returning falsy here means to call the default | ||
// onPotentiallyUnhandledRejection API. This is safe even in | ||
// browserify since process.emit always returns falsy in browserify: | ||
// https://github.com/defunctzombie/node-process/blob/master/browser.js#L40-L46 | ||
return function(type, rejection) { | ||
return type === 'unhandledRejection' | ||
? process.emit(type, rejection.value, rejection) | ||
: process.emit(type, rejection); | ||
}; | ||
} else if(typeof self !== 'undefined' && typeof CustomEvent === 'function') { | ||
return (function(noop, self, CustomEvent) { | ||
var hasCustomEvent = false; | ||
try { | ||
var ev = new CustomEvent('unhandledRejection'); | ||
hasCustomEvent = ev instanceof CustomEvent; | ||
} catch (e) {} | ||
return !hasCustomEvent ? noop : function(type, rejection) { | ||
var ev = new CustomEvent(type, { | ||
detail: { | ||
reason: rejection.value, | ||
key: rejection | ||
}, | ||
bubbles: false, | ||
cancelable: true | ||
}); | ||
return !self.dispatchEvent(ev); | ||
}; | ||
}(noop, self, CustomEvent)); | ||
} | ||
return noop; | ||
} | ||
return Promise; | ||
@@ -888,0 +932,0 @@ }; |
@@ -20,5 +20,5 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
this._queue = new Array(1<<16); | ||
this._queue = this; | ||
this._queueLen = 0; | ||
this._afterQueue = new Array(1<<4); | ||
this._afterQueue = {}; | ||
this._afterQueueLen = 0; | ||
@@ -25,0 +25,0 @@ |
{ | ||
"name": "when", | ||
"version": "3.6.4", | ||
"version": "3.7.0", | ||
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -8,3 +8,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */ | ||
* @author John Hann | ||
* @version 3.6.4 | ||
* @version 3.7.0 | ||
*/ | ||
@@ -11,0 +11,0 @@ (function(define) { 'use strict'; |
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
151975
4499