axios-retry
Advanced tools
Comparing version 4.4.0 to 4.4.1
@@ -162,10 +162,17 @@ "use strict"; | ||
} | ||
return new Promise((resolve, reject) => { | ||
return new Promise((resolve) => { | ||
var _a; | ||
const timeout = setTimeout(() => resolve(axiosInstance(config)), delay); | ||
const abortListener = () => { | ||
clearTimeout(timeout); | ||
resolve(axiosInstance(config)); | ||
}; | ||
const timeout = setTimeout(() => { | ||
var _a; | ||
resolve(axiosInstance(config)); | ||
if ((_a = config.signal) === null || _a === void 0 ? void 0 : _a.removeEventListener) { | ||
config.signal.removeEventListener('abort', abortListener); | ||
} | ||
}, delay); | ||
if ((_a = config.signal) === null || _a === void 0 ? void 0 : _a.addEventListener) { | ||
config.signal.addEventListener('abort', () => { | ||
clearTimeout(timeout); | ||
resolve(axiosInstance(config)); | ||
}, { once: true }); | ||
config.signal.addEventListener('abort', abortListener, { once: true }); | ||
} | ||
@@ -172,0 +179,0 @@ }); |
@@ -133,9 +133,15 @@ import isRetryAllowed from 'is-retry-allowed'; | ||
} | ||
return new Promise((resolve, reject) => { | ||
const timeout = setTimeout(() => resolve(axiosInstance(config)), delay); | ||
return new Promise((resolve) => { | ||
const abortListener = () => { | ||
clearTimeout(timeout); | ||
resolve(axiosInstance(config)); | ||
}; | ||
const timeout = setTimeout(() => { | ||
resolve(axiosInstance(config)); | ||
if (config.signal?.removeEventListener) { | ||
config.signal.removeEventListener('abort', abortListener); | ||
} | ||
}, delay); | ||
if (config.signal?.addEventListener) { | ||
config.signal.addEventListener('abort', () => { | ||
clearTimeout(timeout); | ||
resolve(axiosInstance(config)); | ||
}, { once: true }); | ||
config.signal.addEventListener('abort', abortListener, { once: true }); | ||
} | ||
@@ -142,0 +148,0 @@ }); |
{ | ||
"name": "axios-retry", | ||
"version": "4.4.0", | ||
"version": "4.4.1", | ||
"author": "Rubén Norte <ruben.norte@softonic.com>", | ||
@@ -5,0 +5,0 @@ "description": "Axios plugin that intercepts failed requests and retries them whenever posible.", |
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
31472
574