@jspm/generator
Version:
Package Import Map Generation Tool
25 lines (24 loc) • 1.01 kB
TypeScript
import { clearCache } from "#fetch";
export interface WrappedResponse {
url: string;
headers: Headers;
ok: boolean;
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;
declare let _fetch: WrappedFetch;
/**
* Allows customizing the fetch implementation used by the generator.
*/
export declare function setFetch(fetch: typeof globalThis.fetch | WrappedFetch): void;
export { clearCache, _fetch as fetch };