ztxkutils 2.7.11 → 2.7.14
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/index.js +1 -1
- package/dist/request-5df1ec76.js +2745 -0
- package/dist/request.d.ts +1 -0
- package/dist/request.js +1 -1
- package/dist/stompClient.js +44 -20
- package/package.json +1 -1
package/dist/request.d.ts
CHANGED
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-
|
4
|
+
export { a as default } from './request-5df1ec76.js';
|
5
5
|
import './authority-fad2028d.js';
|
6
6
|
import './crypto-c481f616.js';
|
7
7
|
import 'crypto';
|
package/dist/stompClient.js
CHANGED
@@ -32,25 +32,34 @@ var StompClient = /** @class */ (function () {
|
|
32
32
|
clearTimeout(this.clearIsClient);
|
33
33
|
this.clearIsClient = null;
|
34
34
|
}
|
35
|
+
if (this.clearIsClientNo) {
|
36
|
+
clearTimeout(this.clearIsClientNo);
|
37
|
+
this.clearIsClientNo = null;
|
38
|
+
}
|
39
|
+
if (this.clearIsClientYes) {
|
40
|
+
clearTimeout(this.clearIsClientYes);
|
41
|
+
this.clearIsClientYes = null;
|
42
|
+
}
|
35
43
|
this.clearIsClient = setTimeout(function () {
|
36
44
|
_this.clearIsClient = null;
|
37
45
|
if (!_this.isClient) {
|
38
|
-
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!");
|
46
|
+
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!system=" + _this.connectWsConfig.systemType);
|
39
47
|
try {
|
40
48
|
_this.client.disconnect(function () {
|
41
|
-
|
42
|
-
// Math.ceil(this.reconnectionNum / 5) *
|
43
|
-
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
49
|
+
_this.client = null;
|
44
50
|
});
|
45
51
|
}
|
46
52
|
catch (err) {
|
47
53
|
console.log('---连接未建立的关闭出错---', err);
|
48
54
|
}
|
49
|
-
_this.client = null;
|
50
55
|
_this.reconnectionNum++;
|
51
56
|
var timeInterval = 3000;
|
52
|
-
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\
|
53
|
-
|
57
|
+
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01time=" + Date.now() + "system=" + _this.connectWsConfig.systemType + "---");
|
58
|
+
if (_this.clearIsClientNo) {
|
59
|
+
clearTimeout(_this.clearIsClientNo);
|
60
|
+
_this.clearIsClientNo = null;
|
61
|
+
}
|
62
|
+
_this.clearIsClientNo = setTimeout(function () {
|
54
63
|
_this.init();
|
55
64
|
}, timeInterval > 10000 ? 10000 : timeInterval);
|
56
65
|
}
|
@@ -74,8 +83,16 @@ var StompClient = /** @class */ (function () {
|
|
74
83
|
clearTimeout(_this.clearIsClient);
|
75
84
|
_this.clearIsClient = null;
|
76
85
|
}
|
86
|
+
if (_this.clearIsClientNo) {
|
87
|
+
clearTimeout(_this.clearIsClientNo);
|
88
|
+
_this.clearIsClientNo = null;
|
89
|
+
}
|
90
|
+
if (_this.clearIsClientYes) {
|
91
|
+
clearTimeout(_this.clearIsClientYes);
|
92
|
+
_this.clearIsClientYes = null;
|
93
|
+
}
|
77
94
|
_this.reconnectionNum = 0;
|
78
|
-
console.log(
|
95
|
+
console.log("---------\u8FDE\u63A5\u6210\u529F time=" + Date.now() + " system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
|
79
96
|
// 连接成功后,将当前已注册的,未执行的 连接通道 连接
|
80
97
|
var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
|
81
98
|
if (Array.isArray(subscriptionsFnKeys)) {
|
@@ -108,13 +125,21 @@ var StompClient = /** @class */ (function () {
|
|
108
125
|
},
|
109
126
|
// 连接失败回调
|
110
127
|
function (err) {
|
111
|
-
console.log(
|
128
|
+
console.log("---------\u8FDE\u63A5\u5931\u8D25 system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
|
112
129
|
console.log(err);
|
113
130
|
_this.isClient = true;
|
114
131
|
if (_this.clearIsClient) {
|
115
132
|
clearTimeout(_this.clearIsClient);
|
116
133
|
_this.clearIsClient = null;
|
117
134
|
}
|
135
|
+
if (_this.clearIsClientNo) {
|
136
|
+
clearTimeout(_this.clearIsClientNo);
|
137
|
+
_this.clearIsClientNo = null;
|
138
|
+
}
|
139
|
+
if (_this.clearIsClientYes) {
|
140
|
+
clearTimeout(_this.clearIsClientYes);
|
141
|
+
_this.clearIsClientYes = null;
|
142
|
+
}
|
118
143
|
// this.errorCallback(err);
|
119
144
|
// 连接失败后,将当前已注册的 连接通道 全部置为未执行状态
|
120
145
|
var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
|
@@ -145,22 +170,19 @@ var StompClient = /** @class */ (function () {
|
|
145
170
|
// 重连间隔,每隔5秒递增,超过最大间隔时间后,取最大间隔时间重连
|
146
171
|
try {
|
147
172
|
_this.client.disconnect(function () {
|
148
|
-
|
149
|
-
// Math.ceil(this.reconnectionNum / 5) *
|
150
|
-
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
173
|
+
_this.client = null;
|
151
174
|
});
|
152
175
|
}
|
153
176
|
catch (err) {
|
154
|
-
console.log(
|
177
|
+
console.log("---\u8FDE\u63A5\u5DF2\u5EFA\u7ACB\u7684\u5173\u95ED\u51FA\u9519 time=" + Date.now() + "system=" + _this.connectWsConfig.systemType + "---", err);
|
155
178
|
}
|
156
|
-
_this.client = null;
|
157
179
|
_this.reconnectionNum++;
|
158
180
|
// const timeInterval =
|
159
181
|
// Math.ceil(this.reconnectionNum / 5) *
|
160
182
|
// (this.connectWsConfig.reconnectionTime ?? 3000);
|
161
183
|
var timeInterval = 3000;
|
162
|
-
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\
|
163
|
-
setTimeout(function () {
|
184
|
+
console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01time=" + Date.now() + "system=" + _this.connectWsConfig.systemType);
|
185
|
+
_this.clearIsClientYes = setTimeout(function () {
|
164
186
|
_this.init();
|
165
187
|
}, timeInterval);
|
166
188
|
});
|
@@ -189,10 +211,12 @@ var StompClient = /** @class */ (function () {
|
|
189
211
|
callback = undefined;
|
190
212
|
}
|
191
213
|
var subscriptionsFn = function () {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
214
|
+
if (_this.client) {
|
215
|
+
var subscription = _this.client.subscribe(pipe, function (response) {
|
216
|
+
callback && callback(response);
|
217
|
+
}, headers);
|
218
|
+
_this.subscriptions[subscribeId] = subscription;
|
219
|
+
}
|
196
220
|
};
|
197
221
|
if ((_a = this.client) === null || _a === void 0 ? void 0 : _a.connected) {
|
198
222
|
// 如果是连接状态 正常执行函数
|