-
Notifications
You must be signed in to change notification settings - Fork 17
/
wx.d.ts
42 lines (39 loc) · 1.01 KB
/
wx.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
declare namespace wx {
interface SocketTask {
send(obj: { data: any }): void;
close(obj?: any): void;
onOpen(func?: any): void;
onClose(func?: any): void;
onError(func?: any): void;
onMessage(func?: any): void;
}
/**
* 通用的回调型函数参数
*/
interface CommonCallbackParam {
/**
* 接口调用成功的回调函数
*/
success?: Function;
/**
* 接口调用失败的回调函数
*/
fail?: Function;
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: Function;
}
interface SocketParam extends CommonCallbackParam {
url: string;
/**
* HTTP Header,Header 中不能设置 Referer
*/
header?: Object;
/**
* 子协议数组
*/
protocols?: Array<string>;
}
function connectSocket(param: SocketParam): SocketTask;
}