@nextgis/geocoder 1.12.1 → 1.13.2

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./lib/geocoder.cjs.prod.js');
5
- } else {
3
+ if (process.env.NODE_ENV === 'development') {
6
4
  module.exports = require('./lib/geocoder.cjs.js');
5
+ } else {
6
+ module.exports = require('./lib/geocoder.cjs.prod.js');
7
7
  }
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/geocoder; version: 1.12.1; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 1.13.2; author: NextGIS */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/geocoder; version: 1.12.1; author: NextGIS */
1
+ /** Bundle of @nextgis/geocoder; version: 1.13.2; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -1370,31 +1370,31 @@ var Cache = Cache$1;
1370
1370
  /**
1371
1371
  * Thrown when...
1372
1372
  */
1373
- var NgwError = /** @class */ (function (_super) {
1374
- __extends(NgwError, _super);
1375
- function NgwError(er) {
1373
+ var NetworkError = /** @class */ (function (_super) {
1374
+ __extends(NetworkError, _super);
1375
+ function NetworkError(url) {
1376
1376
  var _this = _super.call(this) || this;
1377
- _this.name = 'NgwError';
1378
- Object.assign(_this, er);
1379
- Object.setPrototypeOf(_this, NgwError.prototype);
1377
+ _this.name = 'NetworkError';
1378
+ Object.setPrototypeOf(_this, NetworkError.prototype);
1379
+ _this.message = "Unable to request ".concat(url, ".\n Possibly invalid NGW URL entered or CORS not configured to get request from ").concat(location.origin); // /control-panel/cors
1380
1380
  return _this;
1381
1381
  }
1382
- return NgwError;
1382
+ return NetworkError;
1383
1383
  }(Error));
1384
1384
 
1385
1385
  /**
1386
1386
  * Thrown when...
1387
1387
  */
1388
- var NetworkError = /** @class */ (function (_super) {
1389
- __extends(NetworkError, _super);
1390
- function NetworkError(url) {
1388
+ var NgwError = /** @class */ (function (_super) {
1389
+ __extends(NgwError, _super);
1390
+ function NgwError(er) {
1391
1391
  var _this = _super.call(this) || this;
1392
- _this.name = 'NetworkError';
1393
- Object.setPrototypeOf(_this, NetworkError.prototype);
1394
- _this.message = "Unable to request ".concat(url, ".\n Possibly invalid NGW URL entered or CORS not configured to get request from ").concat(location.origin); // /control-panel/cors
1392
+ _this.name = 'NgwError';
1393
+ Object.assign(_this, er);
1394
+ Object.setPrototypeOf(_this, NgwError.prototype);
1395
1395
  return _this;
1396
1396
  }
1397
- return NetworkError;
1397
+ return NgwError;
1398
1398
  }(Error));
1399
1399
 
1400
1400
  function isObject(val) {
@@ -1508,11 +1508,6 @@ var loadData;
1508
1508
  xhr.abort();
1509
1509
  });
1510
1510
  }
1511
- if (options.signal) {
1512
- options.signal.addEventListener('abort', function () {
1513
- xhr.abort();
1514
- });
1515
- }
1516
1511
  xhr.send(data);
1517
1512
  };
1518
1513
  }
@@ -2314,7 +2309,7 @@ var NgwConnector$1 = /** @class */ (function () {
2314
2309
  NgwConnector.prototype._loadData = function (url, options) {
2315
2310
  var _this = this;
2316
2311
  options.responseType = options.responseType || 'json';
2317
- return new CancelablePromise(function (resolve, reject, onCancel) {
2312
+ var request = new CancelablePromise(function (resolve, reject, onCancel) {
2318
2313
  if (_this.user) {
2319
2314
  options = options || {};
2320
2315
  // options.withCredentials = true;
@@ -2334,6 +2329,13 @@ var NgwConnector$1 = /** @class */ (function () {
2334
2329
  }
2335
2330
  }
2336
2331
  });
2332
+ if (options.signal &&
2333
+ typeof options.signal.addEventListener === 'function') {
2334
+ options.signal.addEventListener('abort', function () {
2335
+ request.cancel();
2336
+ });
2337
+ }
2338
+ return request;
2337
2339
  };
2338
2340
  NgwConnector.prototype._handleHttpError = function (er) {
2339
2341
  if (er) {