@jspm/generator
Version:
Package Import Map Generation Tool
19 lines (18 loc) • 855 B
TypeScript
export interface WrappedResponse {
status: number;
statusText?: string;
text?(): Promise<string>;
json?(): Promise<any>;
arrayBuffer?(): ArrayBuffer;
}
export type FetchFn = (url: URL | string, ...args: any[]) => Promise<WrappedResponse | globalThis.Response>;
export type WrappedFetch = ((url: URL | string, ...args: any[]) => Promise<WrappedResponse | globalThis.Response>) & {
arrayBuffer: (url: URL | string, ...args: any[]) => Promise<ArrayBuffer | null>;
text: (url: URL | string, ...args: any[]) => Promise<string | null>;
};
export declare function setRetryCount(count: number): void;
export declare function setFetchPoolSize(size: number): void;
/**
* Wraps a fetch request with pooling, and retry logic on exceptions (emfile / network errors).
*/
export declare function wrappedFetch(fetch: FetchFn): WrappedFetch;