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.
@@ -342,7 +342,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
342
342
  return Url;
343
343
  }());
344
344
 
345
- var version = "2.1.13";
345
+ var version = "2.1.14";
346
346
 
347
347
  /**
348
348
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -25286,6 +25286,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
25286
25286
  var HijackablePromise = /** @class */ (function () {
25287
25287
  function HijackablePromise(origin) {
25288
25288
  var _this = this;
25289
+ this.isHijacked = function () { return _this._hijackedToResolve !== undefined || _this._hijackedToReject !== undefined; };
25289
25290
  this.isResolved = function () { return _this._hijackedToResolve !== undefined || _this._toResolve !== undefined; };
25290
25291
  this.isRejected = function () { return _this._hijackedToReject !== undefined || _this._toReject !== undefined; };
25291
25292
  this.resultIfResolved = function () { return _this._hijackedToResolve || _this._toResolve; };
@@ -25299,39 +25300,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
25299
25300
  }
25300
25301
  else {
25301
25302
  // we retain the origin, and check if stays the same as resolved
25302
- // to make sure we do nothing if the promise was switched
25303
25303
  var retainedInvocator_1 = _this.origin;
25304
25304
  _this.origin.then(function (result) {
25305
- // origin was switched
25306
- if (retainedInvocator_1 !== _this.origin) {
25305
+ if (_this.isHijacked()) {
25307
25306
  return;
25308
25307
  }
25309
- if (!_this._hijackedToResolve) {
25308
+ // origin was switched during invocation, discard the result and follow the chain
25309
+ if (retainedInvocator_1 !== _this.origin) {
25310
+ _this._thenResolver(resolve, reject);
25311
+ }
25312
+ else {
25310
25313
  _this._toResolve = result;
25311
25314
  resolve(result);
25312
25315
  }
25313
25316
  }).catch(function (error) {
25314
- if (!_this._hijackedToReject) {
25315
- _this._toReject = error;
25316
- reject(error);
25317
- }
25318
- });
25319
- }
25320
- };
25321
- this._catchResolver = function (reject) {
25322
- if (_this._hijackedToReject) {
25323
- reject(_this._hijackedToReject);
25324
- }
25325
- else {
25326
- // we retain the origin, and check if stays the same as resolved
25327
- // to make sure we do nothing if the promise was switched
25328
- var retainedInvocator_2 = _this.origin;
25329
- _this.origin.catch(function (error) {
25330
- // origin was switched
25331
- if (retainedInvocator_2 !== _this.origin) {
25317
+ if (_this.isHijacked()) {
25332
25318
  return;
25333
25319
  }
25334
- if (!_this._hijackedToReject) {
25320
+ // origin was switched during invocation, discard the result and follow the chain
25321
+ if (retainedInvocator_1 !== _this.origin) {
25322
+ _this._thenResolver(resolve, reject);
25323
+ }
25324
+ else {
25335
25325
  _this._toReject = error;
25336
25326
  reject(error);
25337
25327
  }
@@ -25358,14 +25348,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
25358
25348
  // tslint:disable-next-line: no-reserved-keywords
25359
25349
  HijackablePromise.prototype.catch = function (onrejected) {
25360
25350
  var _this = this;
25361
- return new Promise(function (_, reject) {
25351
+ return new Promise(function (resolve, reject) {
25352
+ _this._resolve = resolve;
25362
25353
  _this._reject = reject;
25363
- _this._catchResolver(reject);
25364
- }).then(onrejected);
25354
+ _this._thenResolver(resolve, reject);
25355
+ }).catch(onrejected);
25365
25356
  };
25366
25357
  // tslint:disable-next-line: no-reserved-keywords
25367
25358
  HijackablePromise.prototype.finally = function (onfinally) {
25368
- return this.origin.finally(onfinally);
25359
+ var _this = this;
25360
+ return new Promise(function (resolve, reject) {
25361
+ _this._resolve = resolve;
25362
+ _this._reject = reject;
25363
+ _this._thenResolver(resolve, reject);
25364
+ }).finally(onfinally);
25369
25365
  };
25370
25366
  HijackablePromise.prototype.hijackAndResolve = function (value) {
25371
25367
  this._hijackedToResolve = value;
@@ -25380,16 +25376,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
25380
25376
  }
25381
25377
  };
25382
25378
  HijackablePromise.prototype.switchWith = function (promise) {
25383
- // switching the origin will discard the original in-progress promise result
25379
+ // switching the origin will discard the original in-progress promise result, as well any resolved non-hijacked state
25384
25380
  this.origin = promise;
25385
- // then has been invoked on this promise
25386
- if (this._resolve && this._reject) {
25387
- this._thenResolver(this._resolve, this._reject);
25388
- // catch has been invoked on this promise
25389
- }
25390
- else if (this._reject) {
25391
- this._catchResolver(this._reject);
25392
- }
25381
+ this._toResolve = undefined;
25382
+ this._toReject = undefined;
25393
25383
  };
25394
25384
  return HijackablePromise;
25395
25385
  }());