gis-common 1.1.2 → 1.1.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.
Files changed (2) hide show
  1. package/dist/resource.min.js +11 -175
  2. package/package.json +1 -4
@@ -1,13 +1,13 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("mqtt"));
3
+ module.exports = factory();
4
4
  else if(typeof define === 'function' && define.amd)
5
- define("Gis", ["mqtt"], factory);
5
+ define("Gis", [], factory);
6
6
  else if(typeof exports === 'object')
7
- exports["Gis"] = factory(require("mqtt"));
7
+ exports["Gis"] = factory();
8
8
  else
9
- root["Gis"] = factory(root["mqtt"]);
10
- })(window, function(__WEBPACK_EXTERNAL_MODULE__0__) {
9
+ root["Gis"] = factory();
10
+ })(window, function() {
11
11
  return /******/ (function(modules) { // webpackBootstrap
12
12
  /******/ // The module cache
13
13
  /******/ var installedModules = {};
@@ -91,17 +91,11 @@ return /******/ (function(modules) { // webpackBootstrap
91
91
  /******/
92
92
  /******/
93
93
  /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = 1);
94
+ /******/ return __webpack_require__(__webpack_require__.s = 0);
95
95
  /******/ })
96
96
  /************************************************************************/
97
97
  /******/ ([
98
98
  /* 0 */
99
- /***/ (function(module, exports) {
100
-
101
- module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
102
-
103
- /***/ }),
104
- /* 1 */
105
99
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
106
100
 
107
101
  "use strict";
@@ -132,7 +126,6 @@ __webpack_require__.d(__webpack_exports__, "CanvasDrawer", function() { return /
132
126
  __webpack_require__.d(__webpack_exports__, "ElQuery", function() { return /* reexport */ core_ElQuery; });
133
127
  __webpack_require__.d(__webpack_exports__, "EventDispatcher", function() { return /* reexport */ core_EventDispatcher; });
134
128
  __webpack_require__.d(__webpack_exports__, "HashMap", function() { return /* reexport */ core_HashMap; });
135
- __webpack_require__.d(__webpack_exports__, "MqttClient", function() { return /* reexport */ core_MqttClient; });
136
129
  __webpack_require__.d(__webpack_exports__, "WebSocketClient", function() { return /* reexport */ core_WebSocketClient; });
137
130
  __webpack_require__.d(__webpack_exports__, "WebStorage", function() { return /* reexport */ core_WebStorage; });
138
131
 
@@ -2112,184 +2105,27 @@ var HashMap = function () {
2112
2105
  }();
2113
2106
 
2114
2107
  /* harmony default export */ var core_HashMap = (HashMap);
2115
- // EXTERNAL MODULE: external "mqtt"
2116
- var external_mqtt_ = __webpack_require__(0);
2117
-
2118
- // CONCATENATED MODULE: ./src/core/MqttClient.js
2119
- var MqttClient_createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2120
-
2121
- function MqttClient_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2122
-
2123
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2124
-
2125
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2126
-
2127
-
2128
-
2129
-
2130
-
2131
-
2132
-
2133
- var MqttClient_MqttClient = function (_EventDispatcher) {
2134
- _inherits(MqttClient, _EventDispatcher);
2135
-
2136
- /**
2137
- * Creates an instance of MqttClient.
2138
- * @param {*} config mqtt实例参数
2139
- */
2140
- function MqttClient() {
2141
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2142
-
2143
- MqttClient_classCallCheck(this, MqttClient);
2144
-
2145
- var _this = _possibleConstructorReturn(this, (MqttClient.__proto__ || Object.getPrototypeOf(MqttClient)).call(this));
2146
-
2147
- _this.context = CommUtils.extend(MqttClient.defaultContext, config);
2148
- _this.options = {
2149
- connectTimeout: _this.context.MQTT_TIMEOUTM,
2150
- clientId: CommUtils.generateGuid(),
2151
- username: _this.context.MQTT_USERNAME,
2152
- password: _this.context.MQTT_PASSWORD,
2153
- clean: true
2154
- };
2155
- _this.client = Object(external_mqtt_["connect"])(_this.context.MQTT_SERVICE, _this.options);
2156
- _this._onConnect();
2157
- _this._onMessage();
2158
- MqttClient.instance = _this;
2159
- return _this;
2160
- }
2161
-
2162
- MqttClient_createClass(MqttClient, [{
2163
- key: "_onConnect",
2164
- value: function _onConnect() {
2165
- var _this2 = this;
2166
-
2167
- this.client.on("connect", function () {
2168
- console.log("链接mqtt成功==>" + _this2.context.MQTT_SERVICE);
2169
- _this2.dispatchEvent({ type: EventTypeConstant.MQTT_CONNECT, message: _this2 });
2170
- });
2171
- this.client.on("error", function (err) {
2172
- console.log("链接mqtt报错", err);
2173
- _this2.dispatchEvent({ type: EventTypeConstant.MQTT_ERROR, message: _this2 });
2174
- _this2.client.end();
2175
- _this2.client.reconnect();
2176
- });
2177
- }
2178
- }, {
2179
- key: "_onMessage",
2180
- value: function _onMessage() {
2181
- var _this3 = this;
2182
-
2183
- this.client.on("message", function (topic, message) {
2184
- var dataString = message;
2185
- var data = "";
2186
- if (message instanceof Uint8Array) {
2187
- dataString = message.toString();
2188
- }
2189
- try {
2190
- data = JSON.parse(dataString);
2191
- } catch (error) {
2192
- throw new Error(ErrorTypeConstant.JSON_PARSE_ERROR);
2193
- }
2194
- _this3.dispatchEvent({
2195
- type: EventTypeConstant.MQTT_MESSAGE,
2196
- message: { topic: topic, data: data }
2197
- });
2198
- });
2199
- }
2200
- }, {
2201
- key: "sendMsg",
2202
- value: function sendMsg(topic, msg) {
2203
- if (!this.client.connected) {
2204
- console.error("客户端未连接");
2205
- return;
2206
- }
2207
- this.client.publish(topic, msg, { qos: 1, retain: true });
2208
- }
2209
- }, {
2210
- key: "subscribe",
2211
- value: function subscribe(topic) {
2212
- this.client.subscribe(topic, { qos: 1 }, function (error, res) {
2213
- if (error instanceof Error || res.length === 0) {
2214
- console.error("\u8BA2\u9605\u5931\u8D25==>" + topic, error);
2215
- } else {
2216
- console.log("\u8BA2\u9605\u6210\u529F==>" + topic);
2217
- }
2218
- });
2219
- return this;
2220
- }
2221
- }, {
2222
- key: "unsubscribe",
2223
- value: function unsubscribe(topic) {
2224
- this.client.unsubscribe(topic, { qos: 1 }, function (error, res) {
2225
- if (error instanceof Error || res.length === 0) {
2226
- console.error("\u53D6\u6D88\u8BA2\u9605\u5931\u8D25==>" + topic, error);
2227
- } else {
2228
- console.log("\u53D6\u6D88\u8BA2\u9605\u6210\u529F==>" + topic);
2229
- }
2230
- });
2231
- return this;
2232
- }
2233
- }, {
2234
- key: "unconnect",
2235
- value: function unconnect() {
2236
- this.client.end();
2237
- this.client = null;
2238
- this.dispatchEvent({ type: EventTypeConstant.MQTT_CLOSE, message: null });
2239
- console.log("断开mqtt成功==>" + this.context.MQTT_SERVICE);
2240
- }
2241
- /**
2242
- * @description 获取并冻结mqtt实例
2243
- * @static
2244
- * @param {*} [config={}]
2245
- * @returns {MqttClient}
2246
- */
2247
-
2248
- }], [{
2249
- key: "getInstance",
2250
- value: function getInstance() {
2251
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2252
-
2253
- if (MqttClient.instance) {
2254
- return Object.freeze(MqttClient.instance);
2255
- } else {
2256
- return Object.freeze(new MqttClient(config));
2257
- }
2258
- }
2259
- }]);
2260
-
2261
- return MqttClient;
2262
- }(core_EventDispatcher);
2263
-
2264
- /* harmony default export */ var core_MqttClient = (MqttClient_MqttClient);
2265
-
2266
- MqttClient_MqttClient.defaultContext = {
2267
- MQTT_TIMEOUTM: 20000,
2268
- MQTT_USERNAME: "iRVMS-WEB",
2269
- MQTT_PASSWORD: "novasky888",
2270
- MQTT_SERVICE: "ws://" + window.document.domain + ":20007/mqtt"
2271
- };
2272
2108
  // CONCATENATED MODULE: ./src/core/WebSocketClient.js
2273
2109
  var WebSocketClient_createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2274
2110
 
2275
2111
  function WebSocketClient_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2276
2112
 
2277
- function WebSocketClient_possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2113
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2278
2114
 
2279
- function WebSocketClient_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2115
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2280
2116
 
2281
2117
 
2282
2118
 
2283
2119
 
2284
2120
  var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
2285
- WebSocketClient_inherits(WebSocketClient, _EventDispatcher);
2121
+ _inherits(WebSocketClient, _EventDispatcher);
2286
2122
 
2287
2123
  function WebSocketClient() {
2288
2124
  var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'ws://127.0.0.1:10088';
2289
2125
 
2290
2126
  WebSocketClient_classCallCheck(this, WebSocketClient);
2291
2127
 
2292
- var _this = WebSocketClient_possibleConstructorReturn(this, (WebSocketClient.__proto__ || Object.getPrototypeOf(WebSocketClient)).call(this));
2128
+ var _this = _possibleConstructorReturn(this, (WebSocketClient.__proto__ || Object.getPrototypeOf(WebSocketClient)).call(this));
2293
2129
 
2294
2130
  _this.maxCheckTimes = 10;
2295
2131
  _this.url = url;
@@ -2526,7 +2362,7 @@ var WebStorage_WebStorage = function () {
2526
2362
 
2527
2363
 
2528
2364
 
2529
-
2365
+ // export { default as MqttClient } from "./core/MqttClient";
2530
2366
 
2531
2367
 
2532
2368
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "gis-common",
3
3
  "description": "gis-common",
4
4
  "main": "dist/resource.min.js",
5
- "version": "1.1.2",
5
+ "version": "1.1.3",
6
6
  "author": "Guo.Yan <luv02@vip.qq.com>",
7
7
  "license": "MIT",
8
8
  "private": false,
@@ -10,9 +10,6 @@
10
10
  "dev": "cross-env NODE_ENV=development webpack-dev-server --hot --port 7000",
11
11
  "build": "cross-env NODE_ENV=production webpack --progress"
12
12
  },
13
- "dependencies": {
14
- "mqtt": "^4.2.8"
15
- },
16
13
  "browserslist": [
17
14
  "> 1%",
18
15
  "last 2 versions",