@schibsted/niche-utils
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -1,1 +0,1 @@ | ||
export declare const fetchWrapper: <T>(url: string, options?: RequestInit, timeout?: number, timeoutCallback?: () => void) => Promise<T>; | ||
export declare const fetchWrapper: <T>(url: string, options?: RequestInit, timeout?: number) => Promise<T>; |
@@ -11,9 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { FetchError } from './fetchError'; | ||
export const fetchWrapper = (url, options, timeout, timeoutCallback) => __awaiter(void 0, void 0, void 0, function* () { | ||
export const fetchWrapper = (url, options, timeout) => __awaiter(void 0, void 0, void 0, function* () { | ||
let signal; | ||
if (timeout) { | ||
signal = AbortSignal.timeout(timeout); | ||
if (timeoutCallback) { | ||
signal.onabort = timeoutCallback; | ||
} | ||
} | ||
@@ -20,0 +17,0 @@ const response = yield fetch(url, Object.assign(Object.assign({}, options), { signal })); |
{ | ||
"name": "@schibsted/niche-utils", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"repository": { | ||
@@ -28,3 +28,3 @@ "type": "git", | ||
}, | ||
"gitHead": "90c2c4d7b72a8d3c5afd1444b318e08795cb6ae1" | ||
"gitHead": "fc63e4e3bc5209bf0ccbe4a9810989f4704e15a4" | ||
} |
import { FetchError } from './fetchError'; | ||
export const fetchWrapper = async <T>( | ||
url: string, | ||
options?: RequestInit, | ||
timeout?: number, | ||
timeoutCallback?: () => void | ||
): Promise<T> => { | ||
export const fetchWrapper = async <T>(url: string, options?: RequestInit, timeout?: number): Promise<T> => { | ||
let signal: AbortSignal | undefined; | ||
@@ -13,6 +8,2 @@ | ||
signal = AbortSignal.timeout(timeout); | ||
if (timeoutCallback) { | ||
signal.onabort = timeoutCallback; | ||
} | ||
} | ||
@@ -19,0 +10,0 @@ |
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
17559
460