abortcontroller-polyfill
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -176,4 +176,2 @@ (function (factory) { | ||
value: function dispatchEvent(event) { | ||
var _this = this; | ||
if (!(event.type in this.listeners)) { | ||
@@ -183,12 +181,12 @@ return; | ||
var debounce = function debounce(callback) { | ||
setTimeout(function () { | ||
return callback.call(_this, event); | ||
}); | ||
}; | ||
var stack = this.listeners[event.type]; | ||
for (var i = 0, l = stack.length; i < l; i++) { | ||
debounce(stack[i]); | ||
try { | ||
stack[i].call(this, event); | ||
} catch (e) { | ||
Promise.resolve().then(function () { | ||
throw e; | ||
}); | ||
} | ||
} | ||
@@ -209,7 +207,7 @@ | ||
function AbortSignal() { | ||
var _this2; | ||
var _this; | ||
_classCallCheck(this, AbortSignal); | ||
_this2 = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
_this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
// constructor has failed to run, then "this.listeners" will still be undefined and then we call | ||
@@ -221,4 +219,4 @@ // the parent constructor directly instead as a workaround. For general details, see babel bug: | ||
if (!_this2.listeners) { | ||
Emitter.call(_assertThisInitialized(_this2)); | ||
if (!_this.listeners) { | ||
Emitter.call(_assertThisInitialized(_this)); | ||
} // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and | ||
@@ -228,3 +226,3 @@ // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl | ||
Object.defineProperty(_assertThisInitialized(_this2), 'aborted', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'aborted', { | ||
value: false, | ||
@@ -234,3 +232,3 @@ writable: true, | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this2), 'onabort', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'onabort', { | ||
value: null, | ||
@@ -240,3 +238,3 @@ writable: true, | ||
}); | ||
return _this2; | ||
return _this; | ||
} | ||
@@ -243,0 +241,0 @@ |
@@ -175,4 +175,2 @@ 'use strict'; | ||
value: function dispatchEvent(event) { | ||
var _this = this; | ||
if (!(event.type in this.listeners)) { | ||
@@ -182,12 +180,12 @@ return; | ||
var debounce = function debounce(callback) { | ||
setTimeout(function () { | ||
return callback.call(_this, event); | ||
}); | ||
}; | ||
var stack = this.listeners[event.type]; | ||
for (var i = 0, l = stack.length; i < l; i++) { | ||
debounce(stack[i]); | ||
try { | ||
stack[i].call(this, event); | ||
} catch (e) { | ||
Promise.resolve().then(function () { | ||
throw e; | ||
}); | ||
} | ||
} | ||
@@ -208,7 +206,7 @@ | ||
function AbortSignal() { | ||
var _this2; | ||
var _this; | ||
_classCallCheck(this, AbortSignal); | ||
_this2 = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
_this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
// constructor has failed to run, then "this.listeners" will still be undefined and then we call | ||
@@ -220,4 +218,4 @@ // the parent constructor directly instead as a workaround. For general details, see babel bug: | ||
if (!_this2.listeners) { | ||
Emitter.call(_assertThisInitialized(_this2)); | ||
if (!_this.listeners) { | ||
Emitter.call(_assertThisInitialized(_this)); | ||
} // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and | ||
@@ -227,3 +225,3 @@ // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl | ||
Object.defineProperty(_assertThisInitialized(_this2), 'aborted', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'aborted', { | ||
value: false, | ||
@@ -233,3 +231,3 @@ writable: true, | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this2), 'onabort', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'onabort', { | ||
value: null, | ||
@@ -239,3 +237,3 @@ writable: true, | ||
}); | ||
return _this2; | ||
return _this; | ||
} | ||
@@ -242,0 +240,0 @@ |
@@ -175,4 +175,2 @@ 'use strict'; | ||
value: function dispatchEvent(event) { | ||
var _this = this; | ||
if (!(event.type in this.listeners)) { | ||
@@ -182,12 +180,12 @@ return; | ||
var debounce = function debounce(callback) { | ||
setTimeout(function () { | ||
return callback.call(_this, event); | ||
}); | ||
}; | ||
var stack = this.listeners[event.type]; | ||
for (var i = 0, l = stack.length; i < l; i++) { | ||
debounce(stack[i]); | ||
try { | ||
stack[i].call(this, event); | ||
} catch (e) { | ||
Promise.resolve().then(function () { | ||
throw e; | ||
}); | ||
} | ||
} | ||
@@ -208,7 +206,7 @@ | ||
function AbortSignal() { | ||
var _this2; | ||
var _this; | ||
_classCallCheck(this, AbortSignal); | ||
_this2 = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
_this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
// constructor has failed to run, then "this.listeners" will still be undefined and then we call | ||
@@ -220,4 +218,4 @@ // the parent constructor directly instead as a workaround. For general details, see babel bug: | ||
if (!_this2.listeners) { | ||
Emitter.call(_assertThisInitialized(_this2)); | ||
if (!_this.listeners) { | ||
Emitter.call(_assertThisInitialized(_this)); | ||
} // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and | ||
@@ -227,3 +225,3 @@ // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl | ||
Object.defineProperty(_assertThisInitialized(_this2), 'aborted', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'aborted', { | ||
value: false, | ||
@@ -233,3 +231,3 @@ writable: true, | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this2), 'onabort', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'onabort', { | ||
value: null, | ||
@@ -239,3 +237,3 @@ writable: true, | ||
}); | ||
return _this2; | ||
return _this; | ||
} | ||
@@ -242,0 +240,0 @@ |
@@ -176,4 +176,2 @@ (function (factory) { | ||
value: function dispatchEvent(event) { | ||
var _this = this; | ||
if (!(event.type in this.listeners)) { | ||
@@ -183,12 +181,12 @@ return; | ||
var debounce = function debounce(callback) { | ||
setTimeout(function () { | ||
return callback.call(_this, event); | ||
}); | ||
}; | ||
var stack = this.listeners[event.type]; | ||
for (var i = 0, l = stack.length; i < l; i++) { | ||
debounce(stack[i]); | ||
try { | ||
stack[i].call(this, event); | ||
} catch (e) { | ||
Promise.resolve().then(function () { | ||
throw e; | ||
}); | ||
} | ||
} | ||
@@ -209,7 +207,7 @@ | ||
function AbortSignal() { | ||
var _this2; | ||
var _this; | ||
_classCallCheck(this, AbortSignal); | ||
_this2 = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
_this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
// constructor has failed to run, then "this.listeners" will still be undefined and then we call | ||
@@ -221,4 +219,4 @@ // the parent constructor directly instead as a workaround. For general details, see babel bug: | ||
if (!_this2.listeners) { | ||
Emitter.call(_assertThisInitialized(_this2)); | ||
if (!_this.listeners) { | ||
Emitter.call(_assertThisInitialized(_this)); | ||
} // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and | ||
@@ -228,3 +226,3 @@ // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl | ||
Object.defineProperty(_assertThisInitialized(_this2), 'aborted', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'aborted', { | ||
value: false, | ||
@@ -234,3 +232,3 @@ writable: true, | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this2), 'onabort', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'onabort', { | ||
value: null, | ||
@@ -240,3 +238,3 @@ writable: true, | ||
}); | ||
return _this2; | ||
return _this; | ||
} | ||
@@ -243,0 +241,0 @@ |
@@ -176,4 +176,2 @@ (function (factory) { | ||
value: function dispatchEvent(event) { | ||
var _this = this; | ||
if (!(event.type in this.listeners)) { | ||
@@ -183,12 +181,12 @@ return; | ||
var debounce = function debounce(callback) { | ||
setTimeout(function () { | ||
return callback.call(_this, event); | ||
}); | ||
}; | ||
var stack = this.listeners[event.type]; | ||
for (var i = 0, l = stack.length; i < l; i++) { | ||
debounce(stack[i]); | ||
try { | ||
stack[i].call(this, event); | ||
} catch (e) { | ||
Promise.resolve().then(function () { | ||
throw e; | ||
}); | ||
} | ||
} | ||
@@ -209,7 +207,7 @@ | ||
function AbortSignal() { | ||
var _this2; | ||
var _this; | ||
_classCallCheck(this, AbortSignal); | ||
_this2 = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
_this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent | ||
// constructor has failed to run, then "this.listeners" will still be undefined and then we call | ||
@@ -221,4 +219,4 @@ // the parent constructor directly instead as a workaround. For general details, see babel bug: | ||
if (!_this2.listeners) { | ||
Emitter.call(_assertThisInitialized(_this2)); | ||
if (!_this.listeners) { | ||
Emitter.call(_assertThisInitialized(_this)); | ||
} // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and | ||
@@ -228,3 +226,3 @@ // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl | ||
Object.defineProperty(_assertThisInitialized(_this2), 'aborted', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'aborted', { | ||
value: false, | ||
@@ -234,3 +232,3 @@ writable: true, | ||
}); | ||
Object.defineProperty(_assertThisInitialized(_this2), 'onabort', { | ||
Object.defineProperty(_assertThisInitialized(_this), 'onabort', { | ||
value: null, | ||
@@ -240,3 +238,3 @@ writable: true, | ||
}); | ||
return _this2; | ||
return _this; | ||
} | ||
@@ -243,0 +241,0 @@ |
{ | ||
"name": "abortcontroller-polyfill", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Polyfill/ponyfill for the AbortController DOM API + optional patching of fetch (stub that calls catch, doesn't actually abort request).", | ||
@@ -34,3 +34,3 @@ "main": "dist/umd-polyfill.js", | ||
"@wdio/local-runner": "^6.3.6", | ||
"@wdio/selenium-standalone-service": "^6.1.14", | ||
"@wdio/selenium-standalone-service": "^6.11.0", | ||
"@wdio/spec-reporter": "^6.3.6", | ||
@@ -37,0 +37,0 @@ "@wdio/sync": "^6.3.6", |
@@ -27,8 +27,9 @@ class Emitter { | ||
} | ||
const debounce = callback => { | ||
setTimeout(() => callback.call(this, event)); | ||
}; | ||
const stack = this.listeners[event.type]; | ||
for (let i = 0, l = stack.length; i < l; i++) { | ||
debounce(stack[i]); | ||
try { | ||
stack[i].call(this, event); | ||
} catch (e) { | ||
Promise.resolve().then(() => { throw e; }); | ||
} | ||
} | ||
@@ -35,0 +36,0 @@ return !event.defaultPrevented; |
2029
85876