@nextgis/ngw-leaflet 1.13.2 → 1.13.5

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/ngw-leaflet; version: 1.13.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.13.5; author: NextGIS */
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -18704,6 +18704,7 @@ var NgwConnector = /** @class */ (function () {
18704
18704
  this.id = ID$1++;
18705
18705
  this.emitter = new events.exports.EventEmitter();
18706
18706
  this.routeStr = '/api/component/pyramid/route';
18707
+ this.activeRequests = [];
18707
18708
  var exist = findConnector(options);
18708
18709
  if (exist) {
18709
18710
  return exist;
@@ -18789,6 +18790,7 @@ var NgwConnector = /** @class */ (function () {
18789
18790
  * Disconnecting a user. Aborting all current requests
18790
18791
  */
18791
18792
  NgwConnector.prototype.logout = function () {
18793
+ this.abort();
18792
18794
  removeConnector(this);
18793
18795
  this.options.auth = undefined;
18794
18796
  this.user = undefined;
@@ -18841,6 +18843,17 @@ var NgwConnector = /** @class */ (function () {
18841
18843
  }
18842
18844
  }
18843
18845
  };
18846
+ /** Stop all api requests */
18847
+ NgwConnector.prototype.abort = function () {
18848
+ for (var _i = 0, _a = this.activeRequests; _i < _a.length; _i++) {
18849
+ var req = _a[_i];
18850
+ req.cancel();
18851
+ }
18852
+ this.activeRequests = [];
18853
+ };
18854
+ NgwConnector.prototype.getActiveApiRequests = function () {
18855
+ return __spreadArray([], this.activeRequests, true);
18856
+ };
18844
18857
  /**
18845
18858
  * Send request to NGW api router.
18846
18859
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
@@ -19062,7 +19075,13 @@ var NgwConnector = /** @class */ (function () {
19062
19075
  options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
19063
19076
  }
19064
19077
  loadData(url, resolve, options, reject, onCancel);
19065
- }).catch(function (httpError) {
19078
+ })
19079
+ .then(function (resp) {
19080
+ _this._cleanActiveRequests(request);
19081
+ return resp;
19082
+ })
19083
+ .catch(function (httpError) {
19084
+ _this._cleanActiveRequests(request);
19066
19085
  if (httpError instanceof CancelablePromise.CancelError) ;
19067
19086
  else {
19068
19087
  // @ts-ignore
@@ -19081,8 +19100,15 @@ var NgwConnector = /** @class */ (function () {
19081
19100
  request.cancel();
19082
19101
  });
19083
19102
  }
19103
+ this.activeRequests.push(request);
19084
19104
  return request;
19085
19105
  };
19106
+ NgwConnector.prototype._cleanActiveRequests = function (request) {
19107
+ var activeRequestIndex = this.activeRequests.indexOf(request);
19108
+ if (activeRequestIndex !== -1) {
19109
+ this.activeRequests.splice(activeRequestIndex, 1);
19110
+ }
19111
+ };
19086
19112
  NgwConnector.prototype._handleHttpError = function (er) {
19087
19113
  if (er) {
19088
19114
  if (er instanceof NgwError) {