@osovitny/anatoly 2.0.45 → 2.0.47
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.
- package/bundles/osovitny-anatoly.umd.js +39 -26
- package/bundles/osovitny-anatoly.umd.js.map +1 -1
- package/bundles/osovitny-anatoly.umd.min.js +2 -2
- package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
- package/esm2015/lib/core/core.module.js +5 -2
- package/esm2015/lib/core/services/idle.service.js +31 -22
- package/esm2015/lib/core/services/web-storage.service.js +11 -10
- package/fesm2015/osovitny-anatoly.js +39 -25
- package/fesm2015/osovitny-anatoly.js.map +1 -1
- package/lib/core/services/idle.service.d.ts +9 -6
- package/lib/core/services/web-storage.service.d.ts +0 -1
- package/osovitny-anatoly.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -1621,37 +1621,45 @@
|
|
|
1621
1621
|
function IdleService() {
|
|
1622
1622
|
this.expired$ = new rxjs.Subject();
|
|
1623
1623
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
this.
|
|
1624
|
+
//Private
|
|
1625
|
+
IdleService.prototype.resetTimeCounters = function (timeOutSeconds) {
|
|
1626
|
+
this.timeOutSeconds = timeOutSeconds;
|
|
1627
1627
|
this.timeOutMilliSeconds = timeOutSeconds * 1000;
|
|
1628
|
-
this.
|
|
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,
|
|
1637
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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,35 @@
|
|
|
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:
|
|
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(
|
|
1682
|
+
this.storage.setItem(key, value);
|
|
1676
1683
|
};
|
|
1677
1684
|
WebStorageService.prototype.setObject = function (key, value) {
|
|
1678
|
-
this.storage.setItem(
|
|
1685
|
+
this.storage.setItem(key, JSON.stringify(value));
|
|
1679
1686
|
};
|
|
1680
1687
|
WebStorageService.prototype.getItem = function (key) {
|
|
1681
|
-
return this.storage.getItem(
|
|
1688
|
+
return this.storage.getItem(key);
|
|
1682
1689
|
};
|
|
1683
1690
|
WebStorageService.prototype.getObject = function (key) {
|
|
1684
|
-
|
|
1691
|
+
var value = this.storage.getItem(key);
|
|
1692
|
+
if (!value) {
|
|
1693
|
+
return null;
|
|
1694
|
+
}
|
|
1695
|
+
return JSON.parse(value);
|
|
1685
1696
|
};
|
|
1686
1697
|
WebStorageService.prototype.remove = function (key) {
|
|
1687
|
-
this.storage.removeItem(
|
|
1698
|
+
this.storage.removeItem(key);
|
|
1688
1699
|
};
|
|
1689
1700
|
return WebStorageService;
|
|
1690
1701
|
}());
|
|
@@ -1849,7 +1860,9 @@
|
|
|
1849
1860
|
AppContextService,
|
|
1850
1861
|
LoadingService,
|
|
1851
1862
|
DigitalMarketingService,
|
|
1852
|
-
GoogleAnalyticsService
|
|
1863
|
+
GoogleAnalyticsService,
|
|
1864
|
+
LocalStorageService,
|
|
1865
|
+
SessionStorageService
|
|
1853
1866
|
],
|
|
1854
1867
|
},] }
|
|
1855
1868
|
];
|