@osovitny/anatoly 2.1.11 → 2.1.12

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.
@@ -1650,8 +1650,15 @@
1650
1650
  _this.baseUrl = '/api/appContext';
1651
1651
  return _this;
1652
1652
  }
1653
+ //Session
1654
+ AppContextService.prototype.getCurrentFromSession = function () {
1655
+ return this.sessionStorage.getObject(this.storageKeyName);
1656
+ };
1657
+ AppContextService.prototype.setCurrentFromSession = function (value) {
1658
+ this.sessionStorage.setObject(this.storageKeyName, value);
1659
+ };
1653
1660
  AppContextService.prototype.updateCurrentIfExpired = function () {
1654
- var context = this.sessionStorage.getObject(this.storageKeyName);
1661
+ var context = this.getCurrentFromSession();
1655
1662
  if (!context) {
1656
1663
  return;
1657
1664
  }
@@ -1681,10 +1688,10 @@
1681
1688
  var _this = this;
1682
1689
  if (success === void 0) { success = null; }
1683
1690
  if (getCachedIfExist === void 0) { getCachedIfExist = true; }
1684
- var current = this.current;
1685
- if (getCachedIfExist && current != null) {
1691
+ var context = this.getCurrentFromSession();
1692
+ if (getCachedIfExist && context != null) {
1686
1693
  if (success) {
1687
- success(current);
1694
+ success(context);
1688
1695
  }
1689
1696
  return;
1690
1697
  }
@@ -1719,10 +1726,10 @@
1719
1726
  //current
1720
1727
  get: function () {
1721
1728
  this.updateCurrentIfExpired();
1722
- return this.sessionStorage.getObject(this.storageKeyName);
1729
+ return this.getCurrentFromSession();
1723
1730
  },
1724
1731
  set: function (value) {
1725
- this.sessionStorage.setObject(this.storageKeyName, value);
1732
+ this.setCurrentFromSession(value);
1726
1733
  },
1727
1734
  enumerable: false,
1728
1735
  configurable: true