New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

abortcontroller-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abortcontroller-polyfill - npm Package Compare versions

Comparing version 1.2.7 to 1.2.8

204

dist/abortcontroller-polyfill-only.js

@@ -1,59 +0,31 @@

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
factory();
}(function () { 'use strict';
var classCallCheck = function (instance, Constructor) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
}
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var inherits = function (subClass, superClass) {
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
throw new TypeError("Super expression must either be null or a function");
}

@@ -64,3 +36,2 @@

value: subClass,
enumerable: false,
writable: true,

@@ -70,16 +41,72 @@ configurable: true

});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
if (superClass) _setPrototypeOf(subClass, superClass);
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
return self;
}
var Emitter = function () {
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
var Emitter =
/*#__PURE__*/
function () {
function Emitter() {
classCallCheck(this, Emitter);
_classCallCheck(this, Emitter);

@@ -89,4 +116,4 @@ this.listeners = {};

createClass(Emitter, [{
key: 'addEventListener',
_createClass(Emitter, [{
key: "addEventListener",
value: function addEventListener(type, callback) {

@@ -96,6 +123,7 @@ if (!(type in this.listeners)) {

}
this.listeners[type].push(callback);
}
}, {
key: 'removeEventListener',
key: "removeEventListener",
value: function removeEventListener(type, callback) {

@@ -105,3 +133,5 @@ if (!(type in this.listeners)) {

}
var stack = this.listeners[type];
for (var i = 0, l = stack.length; i < l; i++) {

@@ -115,3 +145,3 @@ if (stack[i] === callback) {

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {

@@ -123,2 +153,3 @@ var _this = this;

}
var debounce = function debounce(callback) {

@@ -129,20 +160,27 @@ setTimeout(function () {

};
var stack = this.listeners[event.type];
for (var i = 0, l = stack.length; i < l; i++) {
debounce(stack[i]);
}
return !event.defaultPrevented;
}
}]);
return Emitter;
}();
var AbortSignal = function (_Emitter) {
inherits(AbortSignal, _Emitter);
var AbortSignal =
/*#__PURE__*/
function (_Emitter) {
_inherits(AbortSignal, _Emitter);
function AbortSignal() {
classCallCheck(this, AbortSignal);
var _this2;
var _this2 = possibleConstructorReturn(this, (AbortSignal.__proto__ || Object.getPrototypeOf(AbortSignal)).call(this));
_classCallCheck(this, AbortSignal);
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(AbortSignal).call(this));
_this2.aborted = false;

@@ -153,4 +191,4 @@ _this2.onabort = null;

createClass(AbortSignal, [{
key: 'toString',
_createClass(AbortSignal, [{
key: "toString",
value: function toString() {

@@ -160,6 +198,7 @@ return '[object AbortSignal]';

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {
if (event.type === 'abort') {
this.aborted = true;
if (typeof this.onabort === 'function') {

@@ -170,11 +209,13 @@ this.onabort.call(this, event);

get(AbortSignal.prototype.__proto__ || Object.getPrototypeOf(AbortSignal.prototype), 'dispatchEvent', this).call(this, event);
_get(_getPrototypeOf(AbortSignal.prototype), "dispatchEvent", this).call(this, event);
}
}]);
return AbortSignal;
}(Emitter);
var AbortController = function () {
var AbortController =
/*#__PURE__*/
function () {
function AbortController() {
classCallCheck(this, AbortController);
_classCallCheck(this, AbortController);

@@ -184,6 +225,7 @@ this.signal = new AbortSignal();

createClass(AbortController, [{
key: 'abort',
_createClass(AbortController, [{
key: "abort",
value: function abort() {
var event = void 0;
var event;
try {

@@ -211,6 +253,7 @@ event = new Event('abort');

}
this.signal.dispatchEvent(event);
}
}, {
key: 'toString',
key: "toString",
value: function toString() {

@@ -220,2 +263,3 @@ return '[object AbortController]';

}]);
return AbortController;

@@ -235,5 +279,3 @@ }();

return true;
}
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
} // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -245,2 +287,4 @@ // so the below feature detection needs the !self.AbortController part.

// https://bugs.webkit.org/show_bug.cgi?id=174980#c2
return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;

@@ -259,2 +303,2 @@ }

})));
}));

@@ -5,54 +5,27 @@ 'use strict';

var classCallCheck = function (instance, Constructor) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
}
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var inherits = function (subClass, superClass) {
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
throw new TypeError("Super expression must either be null or a function");
}

@@ -63,3 +36,2 @@

value: subClass,
enumerable: false,
writable: true,

@@ -69,16 +41,72 @@ configurable: true

});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
if (superClass) _setPrototypeOf(subClass, superClass);
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
return self;
}
var Emitter = function () {
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
var Emitter =
/*#__PURE__*/
function () {
function Emitter() {
classCallCheck(this, Emitter);
_classCallCheck(this, Emitter);

@@ -88,4 +116,4 @@ this.listeners = {};

createClass(Emitter, [{
key: 'addEventListener',
_createClass(Emitter, [{
key: "addEventListener",
value: function addEventListener(type, callback) {

@@ -95,6 +123,7 @@ if (!(type in this.listeners)) {

}
this.listeners[type].push(callback);
}
}, {
key: 'removeEventListener',
key: "removeEventListener",
value: function removeEventListener(type, callback) {

@@ -104,3 +133,5 @@ if (!(type in this.listeners)) {

}
var stack = this.listeners[type];
for (var i = 0, l = stack.length; i < l; i++) {

@@ -114,3 +145,3 @@ if (stack[i] === callback) {

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {

@@ -122,2 +153,3 @@ var _this = this;

}
var debounce = function debounce(callback) {

@@ -128,20 +160,27 @@ setTimeout(function () {

};
var stack = this.listeners[event.type];
for (var i = 0, l = stack.length; i < l; i++) {
debounce(stack[i]);
}
return !event.defaultPrevented;
}
}]);
return Emitter;
}();
var AbortSignal = function (_Emitter) {
inherits(AbortSignal, _Emitter);
var AbortSignal =
/*#__PURE__*/
function (_Emitter) {
_inherits(AbortSignal, _Emitter);
function AbortSignal() {
classCallCheck(this, AbortSignal);
var _this2;
var _this2 = possibleConstructorReturn(this, (AbortSignal.__proto__ || Object.getPrototypeOf(AbortSignal)).call(this));
_classCallCheck(this, AbortSignal);
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(AbortSignal).call(this));
_this2.aborted = false;

@@ -152,4 +191,4 @@ _this2.onabort = null;

createClass(AbortSignal, [{
key: 'toString',
_createClass(AbortSignal, [{
key: "toString",
value: function toString() {

@@ -159,6 +198,7 @@ return '[object AbortSignal]';

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {
if (event.type === 'abort') {
this.aborted = true;
if (typeof this.onabort === 'function') {

@@ -169,11 +209,13 @@ this.onabort.call(this, event);

get(AbortSignal.prototype.__proto__ || Object.getPrototypeOf(AbortSignal.prototype), 'dispatchEvent', this).call(this, event);
_get(_getPrototypeOf(AbortSignal.prototype), "dispatchEvent", this).call(this, event);
}
}]);
return AbortSignal;
}(Emitter);
var AbortController = function () {
var AbortController =
/*#__PURE__*/
function () {
function AbortController() {
classCallCheck(this, AbortController);
_classCallCheck(this, AbortController);

@@ -183,6 +225,7 @@ this.signal = new AbortSignal();

createClass(AbortController, [{
key: 'abort',
_createClass(AbortController, [{
key: "abort",
value: function abort() {
var event = void 0;
var event;
try {

@@ -210,6 +253,7 @@ event = new Event('abort');

}
this.signal.dispatchEvent(event);
}
}, {
key: 'toString',
key: "toString",
value: function toString() {

@@ -219,2 +263,3 @@ return '[object AbortController]';

}]);
return AbortController;

@@ -221,0 +266,0 @@ }();

@@ -5,54 +5,27 @@ 'use strict';

var classCallCheck = function (instance, Constructor) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
}
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var inherits = function (subClass, superClass) {
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
throw new TypeError("Super expression must either be null or a function");
}

@@ -63,3 +36,2 @@

value: subClass,
enumerable: false,
writable: true,

@@ -69,16 +41,72 @@ configurable: true

});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
if (superClass) _setPrototypeOf(subClass, superClass);
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
return self;
}
var Emitter = function () {
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
var Emitter =
/*#__PURE__*/
function () {
function Emitter() {
classCallCheck(this, Emitter);
_classCallCheck(this, Emitter);

@@ -88,4 +116,4 @@ this.listeners = {};

createClass(Emitter, [{
key: 'addEventListener',
_createClass(Emitter, [{
key: "addEventListener",
value: function addEventListener(type, callback) {

@@ -95,6 +123,7 @@ if (!(type in this.listeners)) {

}
this.listeners[type].push(callback);
}
}, {
key: 'removeEventListener',
key: "removeEventListener",
value: function removeEventListener(type, callback) {

@@ -104,3 +133,5 @@ if (!(type in this.listeners)) {

}
var stack = this.listeners[type];
for (var i = 0, l = stack.length; i < l; i++) {

@@ -114,3 +145,3 @@ if (stack[i] === callback) {

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {

@@ -122,2 +153,3 @@ var _this = this;

}
var debounce = function debounce(callback) {

@@ -128,20 +160,27 @@ setTimeout(function () {

};
var stack = this.listeners[event.type];
for (var i = 0, l = stack.length; i < l; i++) {
debounce(stack[i]);
}
return !event.defaultPrevented;
}
}]);
return Emitter;
}();
var AbortSignal = function (_Emitter) {
inherits(AbortSignal, _Emitter);
var AbortSignal =
/*#__PURE__*/
function (_Emitter) {
_inherits(AbortSignal, _Emitter);
function AbortSignal() {
classCallCheck(this, AbortSignal);
var _this2;
var _this2 = possibleConstructorReturn(this, (AbortSignal.__proto__ || Object.getPrototypeOf(AbortSignal)).call(this));
_classCallCheck(this, AbortSignal);
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(AbortSignal).call(this));
_this2.aborted = false;

@@ -152,4 +191,4 @@ _this2.onabort = null;

createClass(AbortSignal, [{
key: 'toString',
_createClass(AbortSignal, [{
key: "toString",
value: function toString() {

@@ -159,6 +198,7 @@ return '[object AbortSignal]';

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {
if (event.type === 'abort') {
this.aborted = true;
if (typeof this.onabort === 'function') {

@@ -169,11 +209,13 @@ this.onabort.call(this, event);

get(AbortSignal.prototype.__proto__ || Object.getPrototypeOf(AbortSignal.prototype), 'dispatchEvent', this).call(this, event);
_get(_getPrototypeOf(AbortSignal.prototype), "dispatchEvent", this).call(this, event);
}
}]);
return AbortSignal;
}(Emitter);
var AbortController = function () {
var AbortController =
/*#__PURE__*/
function () {
function AbortController() {
classCallCheck(this, AbortController);
_classCallCheck(this, AbortController);

@@ -183,6 +225,7 @@ this.signal = new AbortSignal();

createClass(AbortController, [{
key: 'abort',
_createClass(AbortController, [{
key: "abort",
value: function abort() {
var event = void 0;
var event;
try {

@@ -210,6 +253,7 @@ event = new Event('abort');

}
this.signal.dispatchEvent(event);
}
}, {
key: 'toString',
key: "toString",
value: function toString() {

@@ -219,2 +263,3 @@ return '[object AbortController]';

}]);
return AbortController;

@@ -234,5 +279,3 @@ }();

return true;
}
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
} // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -244,2 +287,4 @@ // so the below feature detection needs the !self.AbortController part.

// https://bugs.webkit.org/show_bug.cgi?id=174980#c2
return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;

@@ -261,5 +306,8 @@ }

*/
function abortableFetchDecorator(patchTargets) {
if ('function' === typeof patchTargets) {
patchTargets = { fetch: patchTargets };
patchTargets = {
fetch: patchTargets
};
}

@@ -270,13 +318,20 @@

_patchTargets$Request = _patchTargets.Request,
NativeRequest = _patchTargets$Request === undefined ? fetch.Request : _patchTargets$Request,
NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,
NativeAbortController = _patchTargets.AbortController,
_patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === undefined ? false : _patchTargets$__FORCE;
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
if (!polyfillNeeded({ fetch: fetch, Request: NativeRequest, AbortController: NativeAbortController, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL })) {
return { fetch: fetch, Request: Request };
if (!polyfillNeeded({
fetch: fetch,
Request: NativeRequest,
AbortController: NativeAbortController,
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
})) {
return {
fetch: fetch,
Request: Request
};
}
var Request = NativeRequest;
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
var Request = NativeRequest; // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -292,8 +347,9 @@ // hence we only patch it if it's available. Also we don't patch it if signal

// TypeError: Cannot set property signal of #<Request> which has only a getter
if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
Request = function Request(input, init) {
var signal = void 0;
var signal;
if (init && init.signal) {
signal = init.signal;
// Never pass init.signal to the native Request implementation when the polyfill has
signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has
// been installed because if we're running on top of a browser with a

@@ -304,5 +360,8 @@ // working native AbortController (i.e. the polyfill was installed due to

// TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.
delete init.signal;
}
var request = new NativeRequest(input, init);
if (signal) {

@@ -316,4 +375,6 @@ Object.defineProperty(request, 'signal', {

}
return request;
};
Request.prototype = NativeRequest.prototype;

@@ -323,2 +384,3 @@ }

var realFetch = fetch;
var abortableFetch = function abortableFetch(input, init) {

@@ -328,3 +390,4 @@ var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;

if (signal) {
var abortError = void 0;
var abortError;
try {

@@ -337,14 +400,16 @@ abortError = new DOMException('Aborted', 'AbortError');

abortError.name = 'AbortError';
}
} // Return early if already aborted, thus avoiding making an HTTP request
// Return early if already aborted, thus avoiding making an HTTP request
if (signal.aborted) {
return Promise.reject(abortError);
}
} // Turn an event into a promise, reject it once `abort` is dispatched
// Turn an event into a promise, reject it once `abort` is dispatched
var cancellation = new Promise(function (_, reject) {
signal.addEventListener('abort', function () {
return reject(abortError);
}, { once: true });
}, {
once: true
});
});

@@ -360,4 +425,5 @@

delete init.signal;
}
// Return the fastest promise (don't need to wait for request to finish)
} // Return the fastest promise (don't need to wait for request to finish)
return Promise.race([cancellation, realFetch(input, init)]);

@@ -369,3 +435,6 @@ }

return { fetch: abortableFetch, Request: Request };
return {
fetch: abortableFetch,
Request: Request
};
}

@@ -372,0 +441,0 @@

@@ -1,59 +0,31 @@

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
factory();
}(function () { 'use strict';
var classCallCheck = function (instance, Constructor) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
}
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var inherits = function (subClass, superClass) {
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
throw new TypeError("Super expression must either be null or a function");
}

@@ -64,3 +36,2 @@

value: subClass,
enumerable: false,
writable: true,

@@ -70,16 +41,72 @@ configurable: true

});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
if (superClass) _setPrototypeOf(subClass, superClass);
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
return self;
}
var Emitter = function () {
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
var Emitter =
/*#__PURE__*/
function () {
function Emitter() {
classCallCheck(this, Emitter);
_classCallCheck(this, Emitter);

@@ -89,4 +116,4 @@ this.listeners = {};

createClass(Emitter, [{
key: 'addEventListener',
_createClass(Emitter, [{
key: "addEventListener",
value: function addEventListener(type, callback) {

@@ -96,6 +123,7 @@ if (!(type in this.listeners)) {

}
this.listeners[type].push(callback);
}
}, {
key: 'removeEventListener',
key: "removeEventListener",
value: function removeEventListener(type, callback) {

@@ -105,3 +133,5 @@ if (!(type in this.listeners)) {

}
var stack = this.listeners[type];
for (var i = 0, l = stack.length; i < l; i++) {

@@ -115,3 +145,3 @@ if (stack[i] === callback) {

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {

@@ -123,2 +153,3 @@ var _this = this;

}
var debounce = function debounce(callback) {

@@ -129,20 +160,27 @@ setTimeout(function () {

};
var stack = this.listeners[event.type];
for (var i = 0, l = stack.length; i < l; i++) {
debounce(stack[i]);
}
return !event.defaultPrevented;
}
}]);
return Emitter;
}();
var AbortSignal = function (_Emitter) {
inherits(AbortSignal, _Emitter);
var AbortSignal =
/*#__PURE__*/
function (_Emitter) {
_inherits(AbortSignal, _Emitter);
function AbortSignal() {
classCallCheck(this, AbortSignal);
var _this2;
var _this2 = possibleConstructorReturn(this, (AbortSignal.__proto__ || Object.getPrototypeOf(AbortSignal)).call(this));
_classCallCheck(this, AbortSignal);
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(AbortSignal).call(this));
_this2.aborted = false;

@@ -153,4 +191,4 @@ _this2.onabort = null;

createClass(AbortSignal, [{
key: 'toString',
_createClass(AbortSignal, [{
key: "toString",
value: function toString() {

@@ -160,6 +198,7 @@ return '[object AbortSignal]';

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {
if (event.type === 'abort') {
this.aborted = true;
if (typeof this.onabort === 'function') {

@@ -170,11 +209,13 @@ this.onabort.call(this, event);

get(AbortSignal.prototype.__proto__ || Object.getPrototypeOf(AbortSignal.prototype), 'dispatchEvent', this).call(this, event);
_get(_getPrototypeOf(AbortSignal.prototype), "dispatchEvent", this).call(this, event);
}
}]);
return AbortSignal;
}(Emitter);
var AbortController = function () {
var AbortController =
/*#__PURE__*/
function () {
function AbortController() {
classCallCheck(this, AbortController);
_classCallCheck(this, AbortController);

@@ -184,6 +225,7 @@ this.signal = new AbortSignal();

createClass(AbortController, [{
key: 'abort',
_createClass(AbortController, [{
key: "abort",
value: function abort() {
var event = void 0;
var event;
try {

@@ -211,6 +253,7 @@ event = new Event('abort');

}
this.signal.dispatchEvent(event);
}
}, {
key: 'toString',
key: "toString",
value: function toString() {

@@ -220,2 +263,3 @@ return '[object AbortController]';

}]);
return AbortController;

@@ -235,5 +279,3 @@ }();

return true;
}
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
} // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -245,2 +287,4 @@ // so the below feature detection needs the !self.AbortController part.

// https://bugs.webkit.org/show_bug.cgi?id=174980#c2
return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;

@@ -262,5 +306,8 @@ }

*/
function abortableFetchDecorator(patchTargets) {
if ('function' === typeof patchTargets) {
patchTargets = { fetch: patchTargets };
patchTargets = {
fetch: patchTargets
};
}

@@ -271,13 +318,20 @@

_patchTargets$Request = _patchTargets.Request,
NativeRequest = _patchTargets$Request === undefined ? fetch.Request : _patchTargets$Request,
NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,
NativeAbortController = _patchTargets.AbortController,
_patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === undefined ? false : _patchTargets$__FORCE;
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
if (!polyfillNeeded({ fetch: fetch, Request: NativeRequest, AbortController: NativeAbortController, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL })) {
return { fetch: fetch, Request: Request };
if (!polyfillNeeded({
fetch: fetch,
Request: NativeRequest,
AbortController: NativeAbortController,
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
})) {
return {
fetch: fetch,
Request: Request
};
}
var Request = NativeRequest;
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
var Request = NativeRequest; // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -293,8 +347,9 @@ // hence we only patch it if it's available. Also we don't patch it if signal

// TypeError: Cannot set property signal of #<Request> which has only a getter
if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
Request = function Request(input, init) {
var signal = void 0;
var signal;
if (init && init.signal) {
signal = init.signal;
// Never pass init.signal to the native Request implementation when the polyfill has
signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has
// been installed because if we're running on top of a browser with a

@@ -305,5 +360,8 @@ // working native AbortController (i.e. the polyfill was installed due to

// TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.
delete init.signal;
}
var request = new NativeRequest(input, init);
if (signal) {

@@ -317,4 +375,6 @@ Object.defineProperty(request, 'signal', {

}
return request;
};
Request.prototype = NativeRequest.prototype;

@@ -324,2 +384,3 @@ }

var realFetch = fetch;
var abortableFetch = function abortableFetch(input, init) {

@@ -329,3 +390,4 @@ var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;

if (signal) {
var abortError = void 0;
var abortError;
try {

@@ -338,14 +400,16 @@ abortError = new DOMException('Aborted', 'AbortError');

abortError.name = 'AbortError';
}
} // Return early if already aborted, thus avoiding making an HTTP request
// Return early if already aborted, thus avoiding making an HTTP request
if (signal.aborted) {
return Promise.reject(abortError);
}
} // Turn an event into a promise, reject it once `abort` is dispatched
// Turn an event into a promise, reject it once `abort` is dispatched
var cancellation = new Promise(function (_, reject) {
signal.addEventListener('abort', function () {
return reject(abortError);
}, { once: true });
}, {
once: true
});
});

@@ -361,4 +425,5 @@

delete init.signal;
}
// Return the fastest promise (don't need to wait for request to finish)
} // Return the fastest promise (don't need to wait for request to finish)
return Promise.race([cancellation, realFetch(input, init)]);

@@ -370,3 +435,6 @@ }

return { fetch: abortableFetch, Request: Request };
return {
fetch: abortableFetch,
Request: Request
};
}

@@ -391,3 +459,2 @@

self.Request = Request;
Object.defineProperty(self, 'AbortController', {

@@ -399,3 +466,2 @@ writable: true,

});
Object.defineProperty(self, 'AbortSignal', {

@@ -409,2 +475,2 @@ writable: true,

})));
}));

@@ -1,59 +0,31 @@

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
factory();
}(function () { 'use strict';
var classCallCheck = function (instance, Constructor) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
}
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var inherits = function (subClass, superClass) {
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
throw new TypeError("Super expression must either be null or a function");
}

@@ -64,3 +36,2 @@

value: subClass,
enumerable: false,
writable: true,

@@ -70,16 +41,72 @@ configurable: true

});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
if (superClass) _setPrototypeOf(subClass, superClass);
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
return self;
}
var Emitter = function () {
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
var Emitter =
/*#__PURE__*/
function () {
function Emitter() {
classCallCheck(this, Emitter);
_classCallCheck(this, Emitter);

@@ -89,4 +116,4 @@ this.listeners = {};

createClass(Emitter, [{
key: 'addEventListener',
_createClass(Emitter, [{
key: "addEventListener",
value: function addEventListener(type, callback) {

@@ -96,6 +123,7 @@ if (!(type in this.listeners)) {

}
this.listeners[type].push(callback);
}
}, {
key: 'removeEventListener',
key: "removeEventListener",
value: function removeEventListener(type, callback) {

@@ -105,3 +133,5 @@ if (!(type in this.listeners)) {

}
var stack = this.listeners[type];
for (var i = 0, l = stack.length; i < l; i++) {

@@ -115,3 +145,3 @@ if (stack[i] === callback) {

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {

@@ -123,2 +153,3 @@ var _this = this;

}
var debounce = function debounce(callback) {

@@ -129,20 +160,27 @@ setTimeout(function () {

};
var stack = this.listeners[event.type];
for (var i = 0, l = stack.length; i < l; i++) {
debounce(stack[i]);
}
return !event.defaultPrevented;
}
}]);
return Emitter;
}();
var AbortSignal = function (_Emitter) {
inherits(AbortSignal, _Emitter);
var AbortSignal =
/*#__PURE__*/
function (_Emitter) {
_inherits(AbortSignal, _Emitter);
function AbortSignal() {
classCallCheck(this, AbortSignal);
var _this2;
var _this2 = possibleConstructorReturn(this, (AbortSignal.__proto__ || Object.getPrototypeOf(AbortSignal)).call(this));
_classCallCheck(this, AbortSignal);
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(AbortSignal).call(this));
_this2.aborted = false;

@@ -153,4 +191,4 @@ _this2.onabort = null;

createClass(AbortSignal, [{
key: 'toString',
_createClass(AbortSignal, [{
key: "toString",
value: function toString() {

@@ -160,6 +198,7 @@ return '[object AbortSignal]';

}, {
key: 'dispatchEvent',
key: "dispatchEvent",
value: function dispatchEvent(event) {
if (event.type === 'abort') {
this.aborted = true;
if (typeof this.onabort === 'function') {

@@ -170,11 +209,13 @@ this.onabort.call(this, event);

get(AbortSignal.prototype.__proto__ || Object.getPrototypeOf(AbortSignal.prototype), 'dispatchEvent', this).call(this, event);
_get(_getPrototypeOf(AbortSignal.prototype), "dispatchEvent", this).call(this, event);
}
}]);
return AbortSignal;
}(Emitter);
var AbortController = function () {
var AbortController =
/*#__PURE__*/
function () {
function AbortController() {
classCallCheck(this, AbortController);
_classCallCheck(this, AbortController);

@@ -184,6 +225,7 @@ this.signal = new AbortSignal();

createClass(AbortController, [{
key: 'abort',
_createClass(AbortController, [{
key: "abort",
value: function abort() {
var event = void 0;
var event;
try {

@@ -211,6 +253,7 @@ event = new Event('abort');

}
this.signal.dispatchEvent(event);
}
}, {
key: 'toString',
key: "toString",
value: function toString() {

@@ -220,2 +263,3 @@ return '[object AbortController]';

}]);
return AbortController;

@@ -235,5 +279,3 @@ }();

return true;
}
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
} // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -245,2 +287,4 @@ // so the below feature detection needs the !self.AbortController part.

// https://bugs.webkit.org/show_bug.cgi?id=174980#c2
return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;

@@ -262,5 +306,8 @@ }

*/
function abortableFetchDecorator(patchTargets) {
if ('function' === typeof patchTargets) {
patchTargets = { fetch: patchTargets };
patchTargets = {
fetch: patchTargets
};
}

@@ -271,13 +318,20 @@

_patchTargets$Request = _patchTargets.Request,
NativeRequest = _patchTargets$Request === undefined ? fetch.Request : _patchTargets$Request,
NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,
NativeAbortController = _patchTargets.AbortController,
_patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === undefined ? false : _patchTargets$__FORCE;
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
if (!polyfillNeeded({ fetch: fetch, Request: NativeRequest, AbortController: NativeAbortController, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL })) {
return { fetch: fetch, Request: Request };
if (!polyfillNeeded({
fetch: fetch,
Request: NativeRequest,
AbortController: NativeAbortController,
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
})) {
return {
fetch: fetch,
Request: Request
};
}
var Request = NativeRequest;
// Note that the "unfetch" minimal fetch polyfill defines fetch() without
var Request = NativeRequest; // Note that the "unfetch" minimal fetch polyfill defines fetch() without
// defining window.Request, and this polyfill need to work on top of unfetch

@@ -293,8 +347,9 @@ // hence we only patch it if it's available. Also we don't patch it if signal

// TypeError: Cannot set property signal of #<Request> which has only a getter
if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
Request = function Request(input, init) {
var signal = void 0;
var signal;
if (init && init.signal) {
signal = init.signal;
// Never pass init.signal to the native Request implementation when the polyfill has
signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has
// been installed because if we're running on top of a browser with a

@@ -305,5 +360,8 @@ // working native AbortController (i.e. the polyfill was installed due to

// TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.
delete init.signal;
}
var request = new NativeRequest(input, init);
if (signal) {

@@ -317,4 +375,6 @@ Object.defineProperty(request, 'signal', {

}
return request;
};
Request.prototype = NativeRequest.prototype;

@@ -324,2 +384,3 @@ }

var realFetch = fetch;
var abortableFetch = function abortableFetch(input, init) {

@@ -329,3 +390,4 @@ var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;

if (signal) {
var abortError = void 0;
var abortError;
try {

@@ -338,14 +400,16 @@ abortError = new DOMException('Aborted', 'AbortError');

abortError.name = 'AbortError';
}
} // Return early if already aborted, thus avoiding making an HTTP request
// Return early if already aborted, thus avoiding making an HTTP request
if (signal.aborted) {
return Promise.reject(abortError);
}
} // Turn an event into a promise, reject it once `abort` is dispatched
// Turn an event into a promise, reject it once `abort` is dispatched
var cancellation = new Promise(function (_, reject) {
signal.addEventListener('abort', function () {
return reject(abortError);
}, { once: true });
}, {
once: true
});
});

@@ -361,4 +425,5 @@

delete init.signal;
}
// Return the fastest promise (don't need to wait for request to finish)
} // Return the fastest promise (don't need to wait for request to finish)
return Promise.race([cancellation, realFetch(input, init)]);

@@ -370,3 +435,6 @@ }

return { fetch: abortableFetch, Request: Request };
return {
fetch: abortableFetch,
Request: Request
};
}

@@ -391,3 +459,2 @@

self.Request = Request;
Object.defineProperty(self, 'AbortController', {

@@ -399,3 +466,2 @@ writable: true,

});
Object.defineProperty(self, 'AbortSignal', {

@@ -409,2 +475,2 @@ writable: true,

})));
}));
{
"name": "abortcontroller-polyfill",
"version": "1.2.7",
"version": "1.2.8",
"description": "Polyfill/ponyfill for the AbortController DOM API + optional patching of fetch (stub that calls catch, doesn't actually abort request).",

@@ -27,19 +27,19 @@ "main": "dist/umd-polyfill.js",

"devDependencies": {
"@wdio/cli": "^5.7.1",
"@wdio/jasmine-framework": "^5.7.0",
"@wdio/local-runner": "^5.7.1",
"@wdio/selenium-standalone-service": "^5.7.0",
"@wdio/spec-reporter": "^5.7.0",
"@wdio/sync": "^5.7.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/plugin-transform-member-expression-literals": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@wdio/cli": "^5.7.2",
"@wdio/jasmine-framework": "^5.7.2",
"@wdio/local-runner": "^5.7.2",
"@wdio/selenium-standalone-service": "^5.7.2",
"@wdio/spec-reporter": "^5.7.2",
"@wdio/sync": "^5.7.2",
"detect-browser": "^4.1.0",
"eslint": "^5.9.0",
"eslint": "^5.15.1",
"npm-run-all": "^4.1.5",
"rollup": "^0.67.3",
"rollup-plugin-babel": "^3.0.3",
"webdriverio": "^5.7.1"
"rollup": "^1.4.1",
"rollup-plugin-babel": "^4.3.2",
"webdriverio": "^5.7.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc