|
@@ -1,7 +1,19 @@
|
1
|
|
-import { ReadyStateCallback, RequestCallback } from './types/callback';
|
2
|
1
|
import { Packet } from './packet';
|
3
|
2
|
import { Utils } from './utils';
|
4
|
3
|
|
|
4
|
+interface ReadyStateCallback {
|
|
5
|
+ onOpen(ev: Event): void;
|
|
6
|
+ onError(ev: Event): void;
|
|
7
|
+ onClose(ev: Event): void;
|
|
8
|
+}
|
|
9
|
+
|
|
10
|
+interface RequestCallback {
|
|
11
|
+ onStart(): void;
|
|
12
|
+ onSuccess(data: string): void;
|
|
13
|
+ onError(code: number, message: string): void;
|
|
14
|
+ onEnd(): void;
|
|
15
|
+}
|
|
16
|
+
|
5
|
17
|
/**
|
6
|
18
|
* 初始化链接以及收发数据
|
7
|
19
|
*/
|
|
@@ -323,4 +335,4 @@ class Client {
|
323
|
335
|
}
|
324
|
336
|
}
|
325
|
337
|
|
326
|
|
-export { Client };
|
|
338
|
+export { Client, ReadyStateCallback, RequestCallback };
|