ztxkutils 2.7.5 → 2.7.8

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/dist/request.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import './tslib.es6-f9459658.js';
2
2
  import 'axios';
3
3
  import 'ztxkui';
4
- export { a as default } from './request-35b10c4f.js';
4
+ export { a as default } from './request-5b825e2e.js';
5
5
  import './authority-fad2028d.js';
6
6
  import './crypto-c481f616.js';
7
7
  import 'crypto';
@@ -24,23 +24,28 @@ var StompClient = /** @class */ (function () {
24
24
  var socket = new SockJS(this.connectWsConfig.baseUrl + "/api/zmdms-csc-ztim/ws?token=" + token + "&system=" + this.connectWsConfig.systemType + "&clientType=" + this.connectWsConfig.clientType);
25
25
  // 获取 STOMP 子协议的客户端对象
26
26
  this.client = Stomp.over(socket);
27
- this.clearIsClient = setTimeout(function () {
28
- if (!_this.isClient) {
29
- console.log("\u8FDE\u63A5\u5DF2\u53D1\u8D77\uFF0C\u4F46\u662F10\u79D2\u540E\u672A\u6210\u529F\u5EFA\u7ACB\u8FDE\u63A5\uFF0C\u624B\u52A8\u65AD\u5F00\u91CD\u8FDE!");
30
- _this.client.disconnect(function () {
27
+ this.isClient = false;
28
+ if (this.clearIsClient) {
29
+ clearTimeout(this.clearIsClient);
30
+ this.clearIsClient = null;
31
+ this.clearIsClient = setTimeout(function () {
32
+ if (!_this.isClient) {
33
+ console.log("\u8FDE\u63A5\u5DF2\u53D1\u8D77\uFF0C\u4F46\u662F10\u79D2\u540E\u672A\u6210\u529F\u5EFA\u7ACB\u8FDE\u63A5\uFF0C\u624B\u52A8\u65AD\u5F00\u91CD\u8FDE!");
34
+ _this.client.disconnect(function () {
35
+ // const timeInterval =
36
+ // Math.ceil(this.reconnectionNum / 5) *
37
+ // (this.connectWsConfig.reconnectionTime ?? 3000);
38
+ });
31
39
  _this.client = null;
32
40
  _this.reconnectionNum++;
33
- // const timeInterval =
34
- // Math.ceil(this.reconnectionNum / 5) *
35
- // (this.connectWsConfig.reconnectionTime ?? 3000);
36
41
  var timeInterval = 3000;
37
42
  console.log("\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01");
38
43
  setTimeout(function () {
39
44
  _this.init();
40
- }, timeInterval);
41
- });
42
- }
43
- }, 10000);
45
+ }, timeInterval > 10000 ? 10000 : timeInterval);
46
+ }
47
+ }, 20000);
48
+ }
44
49
  // 拦截输出的一大堆垃圾信息
45
50
  this.client.debug = function (str) {
46
51
  if (_this.connectWsConfig.debug) {
@@ -58,6 +63,7 @@ var StompClient = /** @class */ (function () {
58
63
  _this.isClient = true;
59
64
  if (_this.clearIsClient) {
60
65
  clearTimeout(_this.clearIsClient);
66
+ _this.clearIsClient = null;
61
67
  }
62
68
  _this.reconnectionNum = 0;
63
69
  console.log('---------连接成功--------');
@@ -98,6 +104,7 @@ var StompClient = /** @class */ (function () {
98
104
  _this.isClient = true;
99
105
  if (_this.clearIsClient) {
100
106
  clearTimeout(_this.clearIsClient);
107
+ _this.clearIsClient = null;
101
108
  }
102
109
  // this.errorCallback(err);
103
110
  // 连接失败后,将当前已注册的 连接通道 全部置为未执行状态
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.7.5",
3
+ "version": "2.7.8",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",