pr-fetch
Version:
基于fetch额外封装了检查请求、中止请求。
29 lines (28 loc) • 671 B
TypeScript
interface PrFetchOption {
timeout?: number;
check?: boolean;
}
export declare class PrFetch {
#private;
constructor(option?: PrFetchOption);
/**
*
* @param input string | URL | Request
* @param init RequestInit
*/
check: (input: string | URL | Request, init?: RequestInit) => Promise<{
status: "successed" | "failed" | "error" | "timeout";
reason: string;
}>;
/**
*
* @param input string | URL | Request
* @param init RequestInit
*/
request: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
/**
* stop
*/
stop: () => void;
}
export {};