gis-common 1.0.18 → 1.0.19
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/resource.min.js +15 -16
- package/package.json +1 -1
package/dist/resource.min.js
CHANGED
|
@@ -2285,8 +2285,6 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2285
2285
|
WebSocketClient_createClass(WebSocketClient, [{
|
|
2286
2286
|
key: 'connect',
|
|
2287
2287
|
value: function connect() {
|
|
2288
|
-
var _this2 = this;
|
|
2289
|
-
|
|
2290
2288
|
this.checkTimes++;
|
|
2291
2289
|
this.disconnect();
|
|
2292
2290
|
if (this.url) {
|
|
@@ -2294,27 +2292,28 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2294
2292
|
console.info('创建ws连接' + this.url);
|
|
2295
2293
|
this.client = new WebSocket(this.url);
|
|
2296
2294
|
if (this.client) {
|
|
2295
|
+
var self = this;
|
|
2297
2296
|
this.client.onopen = function (message) {
|
|
2298
|
-
|
|
2297
|
+
self.dispatchEvent({
|
|
2299
2298
|
type: EventTypeConstant.WEB_SOCKET_CONNECT,
|
|
2300
2299
|
message: message
|
|
2301
2300
|
});
|
|
2302
2301
|
};
|
|
2303
2302
|
this.client.onmessage = function (message) {
|
|
2304
|
-
|
|
2305
|
-
|
|
2303
|
+
self.connectStatus = true;
|
|
2304
|
+
self.dispatchEvent({
|
|
2306
2305
|
type: EventTypeConstant.WEB_SOCKET_MESSAGE,
|
|
2307
2306
|
message: message
|
|
2308
2307
|
});
|
|
2309
2308
|
};
|
|
2310
2309
|
this.client.onclose = function (message) {
|
|
2311
|
-
|
|
2310
|
+
self.dispatchEvent({
|
|
2312
2311
|
type: EventTypeConstant.WEB_SOCKET_CLOSE,
|
|
2313
2312
|
message: message
|
|
2314
2313
|
});
|
|
2315
2314
|
};
|
|
2316
2315
|
this.client.onerror = function (message) {
|
|
2317
|
-
|
|
2316
|
+
self.dispatchEvent({
|
|
2318
2317
|
type: EventTypeConstant.WEB_SOCKET_ERROR,
|
|
2319
2318
|
message: message
|
|
2320
2319
|
});
|
|
@@ -2341,14 +2340,14 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2341
2340
|
}, {
|
|
2342
2341
|
key: 'connCheckStatus',
|
|
2343
2342
|
value: function connCheckStatus(times) {
|
|
2344
|
-
var
|
|
2343
|
+
var _this2 = this;
|
|
2345
2344
|
|
|
2346
2345
|
if (this.checkTimes > times) return;
|
|
2347
2346
|
setTimeout(function () {
|
|
2348
|
-
if (
|
|
2349
|
-
|
|
2347
|
+
if (_this2.client && _this2.client.readyState !== 0 && _this2.client.readyState !== 1) {
|
|
2348
|
+
_this2.connect();
|
|
2350
2349
|
}
|
|
2351
|
-
|
|
2350
|
+
_this2.connCheckStatus(times);
|
|
2352
2351
|
}, 2000);
|
|
2353
2352
|
}
|
|
2354
2353
|
}, {
|
|
@@ -2364,14 +2363,14 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
|
|
|
2364
2363
|
}, {
|
|
2365
2364
|
key: 'heartbeat',
|
|
2366
2365
|
value: function heartbeat() {
|
|
2367
|
-
var
|
|
2366
|
+
var _this3 = this;
|
|
2368
2367
|
|
|
2369
2368
|
setTimeout(function () {
|
|
2370
|
-
if (
|
|
2371
|
-
|
|
2369
|
+
if (_this3.client && _this3.client.readyState === 1) {
|
|
2370
|
+
_this3.send('HeartBeat');
|
|
2372
2371
|
}
|
|
2373
|
-
console.log('HeartBeat,' +
|
|
2374
|
-
setTimeout(
|
|
2372
|
+
console.log('HeartBeat,' + _this3.url);
|
|
2373
|
+
setTimeout(_this3.heartbeat, 30000);
|
|
2375
2374
|
}, 1000);
|
|
2376
2375
|
}
|
|
2377
2376
|
}], [{
|