@daysnap/horn-jssdk
Version:
原生容器面向 H5 开发者提供的基于容器应用内的网页开发工具包
15 lines (14 loc) • 724 B
TypeScript
import { type FailCallbackResult, type PickOptions } from '../../core';
export type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
export interface RequestOptions<T = any> {
url: string;
data?: any;
header?: {
[props: string]: any;
};
timeout?: number;
method?: Method;
success?: (result: T) => void;
fail?: (err: FailCallbackResult) => void;
}
export declare const request: <P = any, T extends RequestOptions<P> = RequestOptions<P>>(options: T) => import("../../core").PromisifySuccessResult<PickOptions<T>, RequestOptions<P>>;