@zgfe/business-lib 1.1.29-visual.2 → 1.1.29-visual.3

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.
@@ -31,6 +31,12 @@ export default (function () {
31
31
  client.openLog(true);
32
32
  client.onConnected(onConnected);
33
33
  client.onError(onError);
34
+ client.onLogin(function (res) {
35
+ console.log('onLogin', res);
36
+ });
37
+ client.on('login', function (res) {
38
+ console.log('登录监听1', res);
39
+ });
34
40
  }, [client]);
35
41
  function onConnected() {
36
42
  notification.success({
@@ -9,10 +9,11 @@ declare class SocketClient {
9
9
  private pingTimer?;
10
10
  constructor(url: string, params?: Record<string, any>);
11
11
  emit(event: string, payload: SocketClientTypes.Message['data']['payload']): void;
12
- on(type: string, handle: SocketClientTypes.Handler): void;
12
+ on(type: SocketClientTypes.EventType | string, handle: SocketClientTypes.Handler): void;
13
13
  onConnected(handle: SocketClientTypes.Handler): void;
14
14
  onDisconnected(handle: SocketClientTypes.Handler): void;
15
15
  onError(handle: SocketClientTypes.Handler): void;
16
+ onLogin(handle: SocketClientTypes.Handler): void;
16
17
  private _onError;
17
18
  private _onClose;
18
19
  private _onOpen;
@@ -84,6 +84,11 @@ var SocketClient = /*#__PURE__*/function () {
84
84
  value: function onError(handle) {
85
85
  this.on(SocketClientTypes.EventType.error, handle);
86
86
  }
87
+ }, {
88
+ key: "onLogin",
89
+ value: function onLogin(handle) {
90
+ this.on(SocketClientTypes.EventType.login, handle);
91
+ }
87
92
  }, {
88
93
  key: "_onError",
89
94
  value: function _onError(_event) {
@@ -135,6 +140,9 @@ var SocketClient = /*#__PURE__*/function () {
135
140
  }
136
141
  if (res_.type === SocketClientTypes.RequestType.login) {
137
142
  this.log('info', '登录成功');
143
+ this.listeners[SocketClientTypes.EventType.login].forEach(function (handle) {
144
+ handle.call(undefined, res_);
145
+ });
138
146
  return;
139
147
  }
140
148
  var data = res_.data;
@@ -2,7 +2,8 @@ declare namespace SocketClientTypes {
2
2
  enum EventType {
3
3
  connected = "connected",
4
4
  disconnected = "disconnected",
5
- error = "error"
5
+ error = "error",
6
+ login = "login"
6
7
  }
7
8
  enum RequestType {
8
9
  common = 0,
@@ -5,6 +5,7 @@ var SocketClientTypes;
5
5
  EventType["connected"] = "connected";
6
6
  EventType["disconnected"] = "disconnected";
7
7
  EventType["error"] = "error";
8
+ EventType["login"] = "login";
8
9
  })(EventType = SocketClientTypes.EventType || (SocketClientTypes.EventType = {}));
9
10
  var RequestType;
10
11
  (function (RequestType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.29-visual.2",
3
+ "version": "1.1.29-visual.3",
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": "4b4aab8d962968da9a435213ac26f8e7d7473262"
62
+ "gitHead": "b9fd435c515e0eab79ed5a696aeb47dc41247d47"
63
63
  }