@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.
@@ -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
  import CancelablePromise from '@nextgis/cancelable-promise';
3
3
  import { objectAssign, fixUrlStr } from '@nextgis/utils';
4
4
  import NgwConnector from '@nextgis/ngw-connector';
@@ -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
  var Geocoder = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1373,31 +1373,31 @@ var Geocoder = (function (exports) {
1373
1373
  /**
1374
1374
  * Thrown when...
1375
1375
  */
1376
- var NgwError = /** @class */ (function (_super) {
1377
- __extends(NgwError, _super);
1378
- function NgwError(er) {
1376
+ var NetworkError = /** @class */ (function (_super) {
1377
+ __extends(NetworkError, _super);
1378
+ function NetworkError(url) {
1379
1379
  var _this = _super.call(this) || this;
1380
- _this.name = 'NgwError';
1381
- Object.assign(_this, er);
1382
- Object.setPrototypeOf(_this, NgwError.prototype);
1380
+ _this.name = 'NetworkError';
1381
+ Object.setPrototypeOf(_this, NetworkError.prototype);
1382
+ _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
1383
1383
  return _this;
1384
1384
  }
1385
- return NgwError;
1385
+ return NetworkError;
1386
1386
  }(Error));
1387
1387
 
1388
1388
  /**
1389
1389
  * Thrown when...
1390
1390
  */
1391
- var NetworkError = /** @class */ (function (_super) {
1392
- __extends(NetworkError, _super);
1393
- function NetworkError(url) {
1391
+ var NgwError = /** @class */ (function (_super) {
1392
+ __extends(NgwError, _super);
1393
+ function NgwError(er) {
1394
1394
  var _this = _super.call(this) || this;
1395
- _this.name = 'NetworkError';
1396
- Object.setPrototypeOf(_this, NetworkError.prototype);
1397
- _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
1395
+ _this.name = 'NgwError';
1396
+ Object.assign(_this, er);
1397
+ Object.setPrototypeOf(_this, NgwError.prototype);
1398
1398
  return _this;
1399
1399
  }
1400
- return NetworkError;
1400
+ return NgwError;
1401
1401
  }(Error));
1402
1402
 
1403
1403
  function isObject(val) {
@@ -1511,11 +1511,6 @@ var Geocoder = (function (exports) {
1511
1511
  xhr.abort();
1512
1512
  });
1513
1513
  }
1514
- if (options.signal) {
1515
- options.signal.addEventListener('abort', function () {
1516
- xhr.abort();
1517
- });
1518
- }
1519
1514
  xhr.send(data);
1520
1515
  };
1521
1516
  }
@@ -2317,7 +2312,7 @@ var Geocoder = (function (exports) {
2317
2312
  NgwConnector.prototype._loadData = function (url, options) {
2318
2313
  var _this = this;
2319
2314
  options.responseType = options.responseType || 'json';
2320
- return new CancelablePromise(function (resolve, reject, onCancel) {
2315
+ var request = new CancelablePromise(function (resolve, reject, onCancel) {
2321
2316
  if (_this.user) {
2322
2317
  options = options || {};
2323
2318
  // options.withCredentials = true;
@@ -2337,6 +2332,13 @@ var Geocoder = (function (exports) {
2337
2332
  }
2338
2333
  }
2339
2334
  });
2335
+ if (options.signal &&
2336
+ typeof options.signal.addEventListener === 'function') {
2337
+ options.signal.addEventListener('abort', function () {
2338
+ request.cancel();
2339
+ });
2340
+ }
2341
+ return request;
2340
2342
  };
2341
2343
  NgwConnector.prototype._handleHttpError = function (er) {
2342
2344
  if (er) {