azure-maps-control 2.1.13 → 2.1.14

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.
@@ -43487,7 +43487,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43487
43487
  return Url;
43488
43488
  }());
43489
43489
 
43490
- var version = "2.1.13";
43490
+ var version = "2.1.14";
43491
43491
 
43492
43492
  /**
43493
43493
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -68413,6 +68413,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68413
68413
  var HijackablePromise = /** @class */ (function () {
68414
68414
  function HijackablePromise(origin) {
68415
68415
  var _this = this;
68416
+ this.isHijacked = function () { return _this._hijackedToResolve !== undefined || _this._hijackedToReject !== undefined; };
68416
68417
  this.isResolved = function () { return _this._hijackedToResolve !== undefined || _this._toResolve !== undefined; };
68417
68418
  this.isRejected = function () { return _this._hijackedToReject !== undefined || _this._toReject !== undefined; };
68418
68419
  this.resultIfResolved = function () { return _this._hijackedToResolve || _this._toResolve; };
@@ -68426,39 +68427,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68426
68427
  }
68427
68428
  else {
68428
68429
  // we retain the origin, and check if stays the same as resolved
68429
- // to make sure we do nothing if the promise was switched
68430
68430
  var retainedInvocator_1 = _this.origin;
68431
68431
  _this.origin.then(function (result) {
68432
- // origin was switched
68433
- if (retainedInvocator_1 !== _this.origin) {
68432
+ if (_this.isHijacked()) {
68434
68433
  return;
68435
68434
  }
68436
- if (!_this._hijackedToResolve) {
68435
+ // origin was switched during invocation, discard the result and follow the chain
68436
+ if (retainedInvocator_1 !== _this.origin) {
68437
+ _this._thenResolver(resolve, reject);
68438
+ }
68439
+ else {
68437
68440
  _this._toResolve = result;
68438
68441
  resolve(result);
68439
68442
  }
68440
68443
  }).catch(function (error) {
68441
- if (!_this._hijackedToReject) {
68442
- _this._toReject = error;
68443
- reject(error);
68444
- }
68445
- });
68446
- }
68447
- };
68448
- this._catchResolver = function (reject) {
68449
- if (_this._hijackedToReject) {
68450
- reject(_this._hijackedToReject);
68451
- }
68452
- else {
68453
- // we retain the origin, and check if stays the same as resolved
68454
- // to make sure we do nothing if the promise was switched
68455
- var retainedInvocator_2 = _this.origin;
68456
- _this.origin.catch(function (error) {
68457
- // origin was switched
68458
- if (retainedInvocator_2 !== _this.origin) {
68444
+ if (_this.isHijacked()) {
68459
68445
  return;
68460
68446
  }
68461
- if (!_this._hijackedToReject) {
68447
+ // origin was switched during invocation, discard the result and follow the chain
68448
+ if (retainedInvocator_1 !== _this.origin) {
68449
+ _this._thenResolver(resolve, reject);
68450
+ }
68451
+ else {
68462
68452
  _this._toReject = error;
68463
68453
  reject(error);
68464
68454
  }
@@ -68485,14 +68475,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68485
68475
  // tslint:disable-next-line: no-reserved-keywords
68486
68476
  HijackablePromise.prototype.catch = function (onrejected) {
68487
68477
  var _this = this;
68488
- return new Promise(function (_, reject) {
68478
+ return new Promise(function (resolve, reject) {
68479
+ _this._resolve = resolve;
68489
68480
  _this._reject = reject;
68490
- _this._catchResolver(reject);
68491
- }).then(onrejected);
68481
+ _this._thenResolver(resolve, reject);
68482
+ }).catch(onrejected);
68492
68483
  };
68493
68484
  // tslint:disable-next-line: no-reserved-keywords
68494
68485
  HijackablePromise.prototype.finally = function (onfinally) {
68495
- return this.origin.finally(onfinally);
68486
+ var _this = this;
68487
+ return new Promise(function (resolve, reject) {
68488
+ _this._resolve = resolve;
68489
+ _this._reject = reject;
68490
+ _this._thenResolver(resolve, reject);
68491
+ }).finally(onfinally);
68496
68492
  };
68497
68493
  HijackablePromise.prototype.hijackAndResolve = function (value) {
68498
68494
  this._hijackedToResolve = value;
@@ -68507,16 +68503,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68507
68503
  }
68508
68504
  };
68509
68505
  HijackablePromise.prototype.switchWith = function (promise) {
68510
- // switching the origin will discard the original in-progress promise result
68506
+ // switching the origin will discard the original in-progress promise result, as well any resolved non-hijacked state
68511
68507
  this.origin = promise;
68512
- // then has been invoked on this promise
68513
- if (this._resolve && this._reject) {
68514
- this._thenResolver(this._resolve, this._reject);
68515
- // catch has been invoked on this promise
68516
- }
68517
- else if (this._reject) {
68518
- this._catchResolver(this._reject);
68519
- }
68508
+ this._toResolve = undefined;
68509
+ this._toReject = undefined;
68520
68510
  };
68521
68511
  return HijackablePromise;
68522
68512
  }());