@osovitny/anatoly 2.0.45 → 2.0.46

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.
@@ -1621,37 +1621,45 @@
1621
1621
  function IdleService() {
1622
1622
  this.expired$ = new rxjs.Subject();
1623
1623
  }
1624
- IdleService.prototype.startWatching = function (timeOutSeconds) {
1625
- var _this = this;
1626
- this.idle$ = rxjs.merge(rxjs.fromEvent(document, "mousemove"), rxjs.fromEvent(document, "click"), rxjs.fromEvent(document, "mousedown"), rxjs.fromEvent(document, "keypress"), rxjs.fromEvent(document, "DOMMouseScroll"), rxjs.fromEvent(document, "mousewheel"), rxjs.fromEvent(document, "touchmove"), rxjs.fromEvent(document, "MSPointerMove"), rxjs.fromEvent(window, "mousemove"), rxjs.fromEvent(window, "resize"));
1624
+ //Private
1625
+ IdleService.prototype.resetTimeCounters = function (timeOutSeconds) {
1626
+ this.timeOutSeconds = timeOutSeconds;
1627
1627
  this.timeOutMilliSeconds = timeOutSeconds * 1000;
1628
- this.idleSubscription = this.idle$.subscribe(function (res) {
1629
- _this.resetTimer();
1630
- });
1631
- this.startTimer();
1632
- return this.expired$;
1628
+ this.startDate = new Date();
1633
1629
  };
1634
1630
  IdleService.prototype.startTimer = function () {
1635
1631
  var _this = this;
1636
- this.timer$ = rxjs.timer(this.timeOutMilliSeconds, this.timeOutMilliSeconds).subscribe(function (res) {
1637
- _this.expired$.next(true);
1632
+ this.timer$ = rxjs.timer(this.timeOutMilliSeconds, 1 * 1000).subscribe(function (res) {
1633
+ var nowDate = new Date();
1634
+ var exiredDate = new Date(_this.startDate.getTime() + _this.timeOutMilliSeconds);
1635
+ if (nowDate.getTime() >= exiredDate.getTime()) {
1636
+ //console.log("nowDate: " + nowDate);
1637
+ //console.log("exiredDate: " + exiredDate);
1638
+ _this.expired$.next(true);
1639
+ }
1638
1640
  });
1639
1641
  };
1640
1642
  IdleService.prototype.resetTimer = function () {
1641
- this.timer$.unsubscribe();
1643
+ this.startDate = new Date();
1644
+ };
1645
+ //Public
1646
+ IdleService.prototype.startWatching = function (timeOutSeconds) {
1647
+ var _this = this;
1648
+ this.idle$ = rxjs.merge(rxjs.fromEvent(document, 'mousemove'), rxjs.fromEvent(document, 'click'), rxjs.fromEvent(document, 'mousedown'), rxjs.fromEvent(document, 'keypress'), rxjs.fromEvent(document, 'DOMMouseScroll'), rxjs.fromEvent(document, 'mousewheel'), rxjs.fromEvent(document, 'touchmove'), rxjs.fromEvent(document, 'MSPointerMove'), rxjs.fromEvent(window, 'mousemove'), rxjs.fromEvent(window, 'resize'));
1649
+ this.resetTimeCounters(timeOutSeconds);
1650
+ this.idleSubscription = this.idle$.subscribe(function (res) {
1651
+ _this.resetTimer();
1652
+ });
1642
1653
  this.startTimer();
1654
+ return this.expired$;
1643
1655
  };
1644
- IdleService.prototype.stopTimer = function () {
1656
+ IdleService.prototype.stopWatching = function () {
1645
1657
  this.timer$.unsubscribe();
1646
1658
  this.idleSubscription.unsubscribe();
1647
1659
  };
1648
- IdleService.prototype.restartIdleTimer = function () {
1649
- var _this = this;
1660
+ IdleService.prototype.restartIdleTimer = function (timeOutSeconds) {
1650
1661
  this.timer$.unsubscribe();
1651
- this.idleSubscription.unsubscribe();
1652
- this.idleSubscription = this.idle$.subscribe(function (res) {
1653
- _this.resetTimer();
1654
- });
1662
+ this.resetTimeCounters(timeOutSeconds);
1655
1663
  this.startTimer();
1656
1664
  };
1657
1665
  return IdleService;
@@ -1659,32 +1667,31 @@
1659
1667
  IdleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IdleService_Factory() { return new IdleService(); }, token: IdleService, providedIn: "root" });
1660
1668
  IdleService.decorators = [
1661
1669
  { type: i0.Injectable, args: [{
1662
- providedIn: "root",
1670
+ providedIn: 'root'
1663
1671
  },] }
1664
1672
  ];
1665
1673
 
1666
1674
  var WebStorageService = /** @class */ (function () {
1667
1675
  function WebStorageService(storage) {
1668
- this.currentClientKey = AppCoreSettings.SERVICES_CONF.selectedClientID;
1669
1676
  this.storage =
1670
1677
  storage === 'local' || storage === 'localStorage'
1671
1678
  ? localStorage
1672
1679
  : sessionStorage;
1673
1680
  }
1674
1681
  WebStorageService.prototype.setItem = function (key, value) {
1675
- this.storage.setItem(this.currentClientKey + key, value);
1682
+ this.storage.setItem(key, value);
1676
1683
  };
1677
1684
  WebStorageService.prototype.setObject = function (key, value) {
1678
- this.storage.setItem(this.currentClientKey + key, JSON.stringify(value));
1685
+ this.storage.setItem(key, JSON.stringify(value));
1679
1686
  };
1680
1687
  WebStorageService.prototype.getItem = function (key) {
1681
- return this.storage.getItem(this.currentClientKey + key);
1688
+ return this.storage.getItem(key);
1682
1689
  };
1683
1690
  WebStorageService.prototype.getObject = function (key) {
1684
- return JSON.parse(this.storage.getItem(this.currentClientKey + key) || '{}');
1691
+ return JSON.parse(this.storage.getItem(key) || '{}');
1685
1692
  };
1686
1693
  WebStorageService.prototype.remove = function (key) {
1687
- this.storage.removeItem(this.currentClientKey + key);
1694
+ this.storage.removeItem(key);
1688
1695
  };
1689
1696
  return WebStorageService;
1690
1697
  }());
@@ -1849,7 +1856,9 @@
1849
1856
  AppContextService,
1850
1857
  LoadingService,
1851
1858
  DigitalMarketingService,
1852
- GoogleAnalyticsService
1859
+ GoogleAnalyticsService,
1860
+ LocalStorageService,
1861
+ SessionStorageService
1853
1862
  ],
1854
1863
  },] }
1855
1864
  ];