@jetlinks-web/core 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/websocket.ts +5 -4
package/package.json
CHANGED
package/src/websocket.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { wsClient } from '@/utils/websocket';
|
|
2
1
|
import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
|
|
3
2
|
import { Observable, Subject, timer, Subscription, EMPTY } from 'rxjs';
|
|
4
3
|
import { retry, catchError } from 'rxjs/operators';
|
|
5
4
|
import { notification } from 'ant-design-vue';
|
|
6
|
-
import app from '@micro-zoe/micro-app'
|
|
7
|
-
import { log } from 'console';
|
|
8
5
|
|
|
9
6
|
interface WebSocketMessage {
|
|
10
7
|
type: string;
|
|
@@ -36,7 +33,7 @@ export class WebSocketClient {
|
|
|
36
33
|
private wsClient: WebSocketClient | undefined
|
|
37
34
|
|
|
38
35
|
constructor(options?: WS_Options) {
|
|
39
|
-
this.options
|
|
36
|
+
this.setOptions(options)
|
|
40
37
|
this.setupConnectionMonitor();
|
|
41
38
|
if (isApp) {
|
|
42
39
|
(window as any).microApp.addGlobalDataListener((data) => {
|
|
@@ -45,6 +42,10 @@ export class WebSocketClient {
|
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
|
|
45
|
+
public setOptions(options: WS_Options) {
|
|
46
|
+
this.options = options || {}
|
|
47
|
+
}
|
|
48
|
+
|
|
48
49
|
public initWebSocket(url: string) {
|
|
49
50
|
this.url = url;
|
|
50
51
|
}
|