xior
Version:
A lite http request lib based on fetch with plugins support and similar API to axios.
32 lines (29 loc) • 1 kB
text/typescript
import { e as XiorPlugin } from '../xior-D4BXsC0R.mjs';
interface XiorProgressOptions {
/** default: 5*1000ms, 5 seconds */
progressDuration?: number;
}
type BrowserProgressEvent = any;
interface XiorProgressEvent {
loaded: number;
total: number;
progress: number;
bytes?: number;
rate?: number;
estimated?: number;
upload?: boolean;
download?: boolean;
event?: BrowserProgressEvent;
}
interface XiorProgressRequestOptions extends XiorProgressOptions {
onUploadProgress?: (progressEvent: XiorProgressEvent) => void;
onDownloadProgress?: (progressEvent: XiorProgressEvent) => void;
}
/** @ts-ignore */
declare module 'xior' {
interface XiorRequestConfig extends XiorProgressRequestOptions {
}
}
/** upload progress / download progress */
declare function xiorProgressPlugin(options?: XiorProgressOptions): XiorPlugin;
export { type XiorProgressEvent, type XiorProgressOptions, type XiorProgressRequestOptions, xiorProgressPlugin as default };