@zgfe/business-lib 1.1.29-visual.12 → 1.1.29-visual.13

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.
@@ -33,7 +33,8 @@ var ChatPanel = function ChatPanel(_ref) {
33
33
  var _useContext = useContext(BizGlobalDataContext),
34
34
  currentApp = _useContext.currentApp;
35
35
  useEffect(function () {
36
- setClient(new SocketClient('wss://rt2.zhugeio.com/eventtracking/ws', currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey, param));
36
+ var socket = new SocketClient('wss://rt2.zhugeio.com/eventtracking/ws', currentApp === null || currentApp === void 0 ? void 0 : currentApp.appKey, param);
37
+ setClient(socket);
37
38
  return function () {
38
39
  console.log('销毁chat', param);
39
40
  if (!client) return;
@@ -9,7 +9,7 @@ declare class SocketClient {
9
9
  private pingTimer?;
10
10
  private appkey?;
11
11
  constructor(url: string, appkey: string, params?: Record<string, any>);
12
- emit(event: string, payload: SocketClientTypes.Message['data']['payload']): void;
12
+ emit(event: string, payload?: SocketClientTypes.Message['data']['payload']): void;
13
13
  on(type: SocketClientTypes.EventType | string, handle: SocketClientTypes.Handler): void;
14
14
  onConnected(handle: SocketClientTypes.Handler): void;
15
15
  onDisconnected(handle: SocketClientTypes.Handler): void;
@@ -38,6 +38,12 @@ var SocketClient = /*#__PURE__*/function () {
38
38
  key: "emit",
39
39
  value: function emit(event, payload) {
40
40
  var _this$client, _this$client2;
41
+ this.log('info', 'emit message', [event, payload]);
42
+ if (!this.client) {
43
+ this.log('info', '缓存消息', [event, payload]);
44
+ this.catch.push([event, payload]);
45
+ return;
46
+ }
41
47
  switch ((_this$client = this.client) === null || _this$client === void 0 ? void 0 : _this$client.readyState) {
42
48
  case WebSocket.CLOSED:
43
49
  notification.warn({
@@ -53,6 +59,7 @@ var SocketClient = /*#__PURE__*/function () {
53
59
  notification.warn({
54
60
  message: '连接中'
55
61
  });
62
+ this.log('info', '缓存消息', [event, payload]);
56
63
  this.catch.push([event, payload]);
57
64
  break;
58
65
  case WebSocket.OPEN:
@@ -117,6 +124,7 @@ var SocketClient = /*#__PURE__*/function () {
117
124
  (_this$listeners$conne = this.listeners['connected']) === null || _this$listeners$conne === void 0 ? void 0 : _this$listeners$conne.forEach(function (handle) {
118
125
  handle.call(undefined);
119
126
  });
127
+ this.log('info', 'clear catch', this.catch);
120
128
  this.catch.forEach(function (_ref) {
121
129
  var _ref2 = _slicedToArray(_ref, 2),
122
130
  event = _ref2[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.29-visual.12",
3
+ "version": "1.1.29-visual.13",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -59,5 +59,5 @@
59
59
  "react": "^16.12.0 || ^17.0.0",
60
60
  "yorkie": "^2.0.0"
61
61
  },
62
- "gitHead": "79c22519902c666bdb2c86dbfdcc8e71acdf3a65"
62
+ "gitHead": "116b4fc99eda68655070b24288a7cc917ea3d657"
63
63
  }