@zgfe/business-lib 1.1.28 → 1.1.29-visual.0
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/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/socket/demo/demo.d.ts +2 -0
- package/es/socket/demo/demo.js +51 -0
- package/es/socket/demo/index.less +4 -0
- package/es/socket/index.d.ts +27 -0
- package/es/socket/index.js +217 -0
- package/es/socket/types.d.ts +27 -0
- package/es/socket/types.js +18 -0
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -28,7 +28,8 @@ import BizDnd from './dnd';
|
|
|
28
28
|
import BizDetailLayout from './layout/detail';
|
|
29
29
|
import BizLoginForm from './loginForm';
|
|
30
30
|
import DemoWrapper from './demoWrapper';
|
|
31
|
-
|
|
31
|
+
import SocketClient from './socket';
|
|
32
|
+
export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
|
|
32
33
|
export type { UserGroupTypes } from './userGroup/types';
|
|
33
34
|
export type { BizSelectTypes } from './select/types';
|
|
34
35
|
export type { AttributeSelect } from './attributeSelector/types';
|
package/es/index.js
CHANGED
|
@@ -27,4 +27,5 @@ import BizDnd from './dnd';
|
|
|
27
27
|
import BizDetailLayout from './layout/detail';
|
|
28
28
|
import BizLoginForm from './loginForm';
|
|
29
29
|
import DemoWrapper from './demoWrapper';
|
|
30
|
-
|
|
30
|
+
import SocketClient from './socket';
|
|
31
|
+
export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import { SocketClient } from '@zgfe/business-lib';
|
|
9
|
+
import { notification } from 'antd';
|
|
10
|
+
export default (function () {
|
|
11
|
+
var _useState = useState(),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
client = _useState2[0],
|
|
14
|
+
setClient = _useState2[1];
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
setClient(new SocketClient('wss://rt2.zhugeio.com/eventtracking/ws', {
|
|
17
|
+
id: 'eti8-4ilv-876r-1wr5',
|
|
18
|
+
origin: 1,
|
|
19
|
+
appId: '146',
|
|
20
|
+
programId: 'zgej-3det-9edb-dje3',
|
|
21
|
+
type: 3,
|
|
22
|
+
event: 'login',
|
|
23
|
+
payload: {
|
|
24
|
+
unionid: 'hjadfhdskji884bdfd',
|
|
25
|
+
username: 'zhangsan'
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
}, []);
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (!client) return;
|
|
31
|
+
client.onConnected(onConnected);
|
|
32
|
+
client.onError(onError);
|
|
33
|
+
}, [client]);
|
|
34
|
+
function onConnected() {
|
|
35
|
+
notification.success({
|
|
36
|
+
message: '连接成功'
|
|
37
|
+
});
|
|
38
|
+
client.emit('init', {
|
|
39
|
+
msg: '这是初始化信息'
|
|
40
|
+
});
|
|
41
|
+
client.on('init', function (data) {
|
|
42
|
+
console.log('init response', data);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function onError() {
|
|
46
|
+
notification.error({
|
|
47
|
+
message: '连接失败'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
51
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import SocketClientTypes from './types';
|
|
2
|
+
declare class SocketClient {
|
|
3
|
+
private client?;
|
|
4
|
+
private url;
|
|
5
|
+
private params?;
|
|
6
|
+
private listeners;
|
|
7
|
+
private catch;
|
|
8
|
+
constructor(url: string, params?: Record<string, any>);
|
|
9
|
+
emit(event: string, payload: SocketClientTypes.Message['data']['payload']): void;
|
|
10
|
+
on(type: string, handle: SocketClientTypes.Handler): void;
|
|
11
|
+
onConnected(handle: SocketClientTypes.Handler): void;
|
|
12
|
+
onDisconnected(handle: SocketClientTypes.Handler): void;
|
|
13
|
+
onError(handle: SocketClientTypes.Handler): void;
|
|
14
|
+
private _onError;
|
|
15
|
+
private _onClose;
|
|
16
|
+
private _onOpen;
|
|
17
|
+
private onMessage;
|
|
18
|
+
private ping;
|
|
19
|
+
removeAllListeners(): void;
|
|
20
|
+
removeListener(event: string, handle?: SocketClientTypes.Handler): void;
|
|
21
|
+
private login;
|
|
22
|
+
open(url?: string, params?: Record<string, any>): void;
|
|
23
|
+
close(): void;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
private log;
|
|
26
|
+
}
|
|
27
|
+
export default SocketClient;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
import { notification } from 'antd';
|
|
17
|
+
import SocketClientTypes from './types';
|
|
18
|
+
var SocketClient = /*#__PURE__*/function () {
|
|
19
|
+
function SocketClient(url, params) {
|
|
20
|
+
_classCallCheck(this, SocketClient);
|
|
21
|
+
this.client = void 0;
|
|
22
|
+
this.url = void 0;
|
|
23
|
+
this.params = void 0;
|
|
24
|
+
this.listeners = {};
|
|
25
|
+
this.catch = [];
|
|
26
|
+
this.url = url;
|
|
27
|
+
this.params = params;
|
|
28
|
+
this.open();
|
|
29
|
+
}
|
|
30
|
+
_createClass(SocketClient, [{
|
|
31
|
+
key: "emit",
|
|
32
|
+
value: function emit(event, payload) {
|
|
33
|
+
var _this$client, _this$client2;
|
|
34
|
+
switch ((_this$client = this.client) === null || _this$client === void 0 ? void 0 : _this$client.readyState) {
|
|
35
|
+
case WebSocket.CLOSED:
|
|
36
|
+
notification.warn({
|
|
37
|
+
message: '连接已关闭'
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
case WebSocket.CLOSING:
|
|
41
|
+
notification.warn({
|
|
42
|
+
message: '正在关闭连接'
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
case WebSocket.CONNECTING:
|
|
46
|
+
notification.warn({
|
|
47
|
+
message: '连接中'
|
|
48
|
+
});
|
|
49
|
+
this.catch.push([event, payload]);
|
|
50
|
+
break;
|
|
51
|
+
case WebSocket.OPEN:
|
|
52
|
+
(_this$client2 = this.client) === null || _this$client2 === void 0 ? void 0 : _this$client2.send(JSON.stringify({
|
|
53
|
+
type: SocketClientTypes.RequestType.normal,
|
|
54
|
+
data: {
|
|
55
|
+
event: event,
|
|
56
|
+
payload: payload
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "on",
|
|
64
|
+
value: function on(type, handle) {
|
|
65
|
+
if (!this.listeners[type]) {
|
|
66
|
+
this.listeners[type] = [];
|
|
67
|
+
}
|
|
68
|
+
this.listeners[type].push(handle);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "onConnected",
|
|
72
|
+
value: function onConnected(handle) {
|
|
73
|
+
this.on(SocketClientTypes.EventType.connected, handle);
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "onDisconnected",
|
|
77
|
+
value: function onDisconnected(handle) {
|
|
78
|
+
this.on(SocketClientTypes.EventType.disconnected, handle);
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "onError",
|
|
82
|
+
value: function onError(handle) {
|
|
83
|
+
this.on(SocketClientTypes.EventType.error, handle);
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "_onError",
|
|
87
|
+
value: function _onError(_event) {
|
|
88
|
+
var _this$listeners$error;
|
|
89
|
+
this.log('error', 'socket连接异常');
|
|
90
|
+
(_this$listeners$error = this.listeners['error']) === null || _this$listeners$error === void 0 ? void 0 : _this$listeners$error.forEach(function (handle) {
|
|
91
|
+
handle.call(undefined);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "_onClose",
|
|
96
|
+
value: function _onClose(_event) {
|
|
97
|
+
var _this$listeners$disco;
|
|
98
|
+
this.log('error', 'socket连接已关闭');
|
|
99
|
+
(_this$listeners$disco = this.listeners['disconnected']) === null || _this$listeners$disco === void 0 ? void 0 : _this$listeners$disco.forEach(function (handle) {
|
|
100
|
+
handle.call(undefined);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "_onOpen",
|
|
105
|
+
value: function _onOpen(event) {
|
|
106
|
+
var _this$listeners$conne,
|
|
107
|
+
_this = this;
|
|
108
|
+
this.log('info', 'socket连接成功', event);
|
|
109
|
+
this.login();
|
|
110
|
+
(_this$listeners$conne = this.listeners['connected']) === null || _this$listeners$conne === void 0 ? void 0 : _this$listeners$conne.forEach(function (handle) {
|
|
111
|
+
handle.call(undefined);
|
|
112
|
+
});
|
|
113
|
+
this.catch.forEach(function (_ref) {
|
|
114
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
115
|
+
event = _ref2[0],
|
|
116
|
+
payload = _ref2[1];
|
|
117
|
+
_this.emit(event, payload);
|
|
118
|
+
});
|
|
119
|
+
this.catch = [];
|
|
120
|
+
this.ping();
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "onMessage",
|
|
124
|
+
value: function onMessage(event) {
|
|
125
|
+
var res = JSON.parse(event.data);
|
|
126
|
+
var res_ = res.data;
|
|
127
|
+
try {
|
|
128
|
+
res_ = JSON.parse(res.data);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
this.log('info', '非json响应', res_);
|
|
131
|
+
}
|
|
132
|
+
var data = res_.data;
|
|
133
|
+
if (!data || !data.event) return;
|
|
134
|
+
if (this.listeners[data.event]) {
|
|
135
|
+
this.listeners[data.event].forEach(function (handle) {
|
|
136
|
+
handle.call(undefined, data.payload);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "ping",
|
|
142
|
+
value: function ping() {
|
|
143
|
+
var _this2 = this;
|
|
144
|
+
setInterval(function () {
|
|
145
|
+
var _this2$client;
|
|
146
|
+
(_this2$client = _this2.client) === null || _this2$client === void 0 ? void 0 : _this2$client.send(JSON.stringify({
|
|
147
|
+
type: SocketClientTypes.RequestType.ping
|
|
148
|
+
}));
|
|
149
|
+
}, 3000);
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "removeAllListeners",
|
|
153
|
+
value: function removeAllListeners() {
|
|
154
|
+
this.listeners = {};
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "removeListener",
|
|
158
|
+
value: function removeListener(event, handle) {
|
|
159
|
+
var _this3 = this;
|
|
160
|
+
if (handle) {
|
|
161
|
+
this.listeners[event].forEach(function (item, i) {
|
|
162
|
+
if (item === handle) {
|
|
163
|
+
_this3.listeners[event].splice(i, 1);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
this.listeners[event] = [];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "login",
|
|
172
|
+
value: function login() {
|
|
173
|
+
var _this$client3;
|
|
174
|
+
this.log('info', '开始登录', this.params);
|
|
175
|
+
(_this$client3 = this.client) === null || _this$client3 === void 0 ? void 0 : _this$client3.send(JSON.stringify(_objectSpread({
|
|
176
|
+
type: SocketClientTypes.RequestType.normal
|
|
177
|
+
}, this.params)));
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "open",
|
|
181
|
+
value: function open(url, params) {
|
|
182
|
+
this.params = params || this.params;
|
|
183
|
+
if (this.client) this.close();
|
|
184
|
+
var client = new WebSocket(url || this.url);
|
|
185
|
+
this.client = client;
|
|
186
|
+
client.onmessage = this.onMessage.bind(this);
|
|
187
|
+
client.onerror = this._onError.bind(this);
|
|
188
|
+
client.onclose = this._onClose.bind(this);
|
|
189
|
+
client.onopen = this._onOpen.bind(this);
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
key: "close",
|
|
193
|
+
value: function close() {
|
|
194
|
+
var _this$client4;
|
|
195
|
+
(_this$client4 = this.client) === null || _this$client4 === void 0 ? void 0 : _this$client4.close();
|
|
196
|
+
this.log('info', '关闭socket连接');
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "destroy",
|
|
200
|
+
value: function destroy() {
|
|
201
|
+
this.removeAllListeners();
|
|
202
|
+
this.close();
|
|
203
|
+
this.client = undefined;
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "log",
|
|
207
|
+
value: function log(type) {
|
|
208
|
+
var _console;
|
|
209
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
210
|
+
args[_key - 1] = arguments[_key];
|
|
211
|
+
}
|
|
212
|
+
(_console = console)[type].apply(_console, args);
|
|
213
|
+
}
|
|
214
|
+
}]);
|
|
215
|
+
return SocketClient;
|
|
216
|
+
}();
|
|
217
|
+
export default SocketClient;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare namespace SocketClientTypes {
|
|
2
|
+
enum EventType {
|
|
3
|
+
connected = "connected",
|
|
4
|
+
disconnected = "disconnected",
|
|
5
|
+
error = "error"
|
|
6
|
+
}
|
|
7
|
+
enum RequestType {
|
|
8
|
+
common = 0,
|
|
9
|
+
ping = 1,
|
|
10
|
+
login = 3,
|
|
11
|
+
normal = 5,
|
|
12
|
+
img = 6
|
|
13
|
+
}
|
|
14
|
+
type Message = {
|
|
15
|
+
type: RequestType;
|
|
16
|
+
data: {
|
|
17
|
+
event: string;
|
|
18
|
+
payload: Record<string, any> | string | number | boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
interface ResponseData {
|
|
22
|
+
code: string;
|
|
23
|
+
data: Message;
|
|
24
|
+
}
|
|
25
|
+
type Handler = (msg?: Message['data']['payload']) => void;
|
|
26
|
+
}
|
|
27
|
+
export default SocketClientTypes;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var SocketClientTypes;
|
|
2
|
+
(function (SocketClientTypes) {
|
|
3
|
+
var EventType;
|
|
4
|
+
(function (EventType) {
|
|
5
|
+
EventType["connected"] = "connected";
|
|
6
|
+
EventType["disconnected"] = "disconnected";
|
|
7
|
+
EventType["error"] = "error";
|
|
8
|
+
})(EventType = SocketClientTypes.EventType || (SocketClientTypes.EventType = {}));
|
|
9
|
+
var RequestType;
|
|
10
|
+
(function (RequestType) {
|
|
11
|
+
RequestType[RequestType["common"] = 0] = "common";
|
|
12
|
+
RequestType[RequestType["ping"] = 1] = "ping";
|
|
13
|
+
RequestType[RequestType["login"] = 3] = "login";
|
|
14
|
+
RequestType[RequestType["normal"] = 5] = "normal";
|
|
15
|
+
RequestType[RequestType["img"] = 6] = "img";
|
|
16
|
+
})(RequestType = SocketClientTypes.RequestType || (SocketClientTypes.RequestType = {}));
|
|
17
|
+
})(SocketClientTypes || (SocketClientTypes = {}));
|
|
18
|
+
export default SocketClientTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.29-visual.0",
|
|
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": "
|
|
62
|
+
"gitHead": "11e762a9146e1f1d9259774458ba80df10fce4e0"
|
|
63
63
|
}
|