M3D / M3D / Utility / HttpRequestWorker
Class: HttpRequestWorker
Http通信接口 多线程去发起http请求
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new HttpRequestWorker(): HttpRequestWorker
构造函数
Returns
Properties
callBack
• callBack: any
endCallBack
• endCallBack: any
errorCallBack
• errorCallBack: any
startCallBack
• startCallBack: any
xhr
• xhr: XMLHttpRequest
Methods
cancle
▸ cancle(): void
取消
Returns
void
request
▸ request(method
, url
, async
, requestParameters
, onProcess
): Promise
<String
| ArrayBuffer
>
HTTP请求
Parameters
Name | Type | Description |
---|---|---|
method | string | 请求的 HTTP 方法。值包括 GET、POST 和 HEAD |
url | string | 请求地址 |
async | boolean | 请求使用应该异步地执行 |
requestParameters | any | 附加参数,{"username":"", "password":"", "data":{}, "responseType":"", "requestHeader":{"name":"", "value":""}, "onProcess": function } |
onProcess | any | - |
Returns
Promise
<String
| ArrayBuffer
>