Parcourir la source

export client

Paul il y a 5 ans
Parent
révision
49f2c07dfb
4 fichiers modifiés avec 39 ajouts et 3 suppressions
  1. 1
    0
      dist/index.js
  2. 1
    1
      dist/index.js.map
  3. 36
    1
      dist/types/index.d.ts
  4. 1
    1
      src/index.ts

+ 1
- 0
dist/index.js Voir le fichier

@@ -280,4 +280,5 @@ var Client = /** @class */ (function () {
280 280
     };
281 281
     return Client;
282 282
 }());
283
+exports.Client = Client;
283 284
 //# sourceMappingURL=index.js.map

+ 1
- 1
dist/index.js.map
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 36
- 1
dist/types/index.d.ts Voir le fichier

@@ -1 +1,36 @@
1
-export {};
1
+import { readyStateCallback, callback } from './callback';
2
+/**
3
+ * Client ws client, 单例模式, 负责维护连接
4
+ */
5
+export declare class Client {
6
+    callback: callback;
7
+    requestHeader: string;
8
+    responseHeader: string;
9
+    maxPayload: number;
10
+    url: string;
11
+    reconnectTimes: number;
12
+    reconnectLock: boolean;
13
+    socket: WebSocket;
14
+    readyStateCallback: readyStateCallback;
15
+    constructor(url: string, readyStateCallback: readyStateCallback);
16
+    ping(param?: {}, callback?: {}): void;
17
+    send(data: any): void;
18
+    /**
19
+     * asyncSend
20
+     * @param {*} operator
21
+     * @param {*} param
22
+     * @param {*} callback 仅此次有效的callback
23
+     */
24
+    asyncSend(operator: any, param: any, callback: any): void;
25
+    syncSend(operator: any, param: any, callback: any): Promise<void>;
26
+    addMessageListener(operator: any, listener: any): void;
27
+    removeMessageListener(operator: any): void;
28
+    getReadyState(): number;
29
+    setMaxPayload(maxPayload: any): void;
30
+    setRequestProperty(key: any, value: any): void;
31
+    getRequestProperty(key: any): string;
32
+    setResponseProperty(key: any, value: any): void;
33
+    getResponseProperty(key: any): string;
34
+    connect(): WebSocket;
35
+    reconnect(): void;
36
+}

+ 1
- 1
src/index.ts Voir le fichier

@@ -6,7 +6,7 @@ import { Utils } from './utils';
6 6
 /**
7 7
  * Client ws client, 单例模式, 负责维护连接
8 8
  */
9
-class Client {
9
+export class Client {
10 10
   public callback: callback;
11 11
   public requestHeader: string;
12 12
   public responseHeader: string;