imobile_for_reactnative
Version:
iMobile for ReactNative,是SuperMap iMobile推出的一款基于React-Native框架的移动应用开发工具。基于该开发工具,用户可以使用JavaScript开发语言,开发出在Android和IOS操作系统下运行的原生移动GIS应用,入门门槛低,一次开发,处处运行。
26 lines (20 loc) • 560 B
text/typescript
type Methods = "POST" | "GET" | "DELETE" | "PUT" | "post" | "get" | "delete" | "put";
export interface HttpRequestParam {
method: Methods,
url: string,
headers?: {[key:string]: string},
body?: any,
}
export interface HttpResponse {
status: number,
headers: any,
json(): Promise<any>
text(): Promise<string> | string
}
export interface HttpRequestFailed {
error: string
}
/** http访问接口,用来封装不同实现 */
export interface HttpRequest {
request: (param: HttpRequestParam) => Promise<HttpResponse | HttpRequestFailed>
}