@osovitny/anatoly 2.15.8 → 2.15.10
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/esm2020/lib/core/services/appcontext.service.mjs +16 -4
- package/esm2020/lib/core/services/web-storage.service.mjs +5 -5
- package/fesm2015/osovitny-anatoly.mjs +19 -7
- package/fesm2015/osovitny-anatoly.mjs.map +1 -1
- package/fesm2020/osovitny-anatoly.mjs +19 -7
- package/fesm2020/osovitny-anatoly.mjs.map +1 -1
- package/lib/core/services/appcontext.service.d.ts +6 -2
- package/lib/core/services/web-storage.service.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1415,10 +1415,7 @@ BaseApiService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: BaseApiSe
|
|
|
1415
1415
|
*/
|
|
1416
1416
|
class WebStorageService {
|
|
1417
1417
|
constructor(storage) {
|
|
1418
|
-
this.storage =
|
|
1419
|
-
storage === 'local' || storage === 'localStorage'
|
|
1420
|
-
? localStorage
|
|
1421
|
-
: sessionStorage;
|
|
1418
|
+
this.storage = storage === 'local' || storage === 'localStorage' ? localStorage : sessionStorage;
|
|
1422
1419
|
}
|
|
1423
1420
|
setItem(key, value) {
|
|
1424
1421
|
this.storage.setItem(key, value);
|
|
@@ -1439,6 +1436,9 @@ class WebStorageService {
|
|
|
1439
1436
|
remove(key) {
|
|
1440
1437
|
this.storage.removeItem(key);
|
|
1441
1438
|
}
|
|
1439
|
+
clear() {
|
|
1440
|
+
this.storage.clear();
|
|
1441
|
+
}
|
|
1442
1442
|
}
|
|
1443
1443
|
class LocalStorageService extends WebStorageService {
|
|
1444
1444
|
constructor() {
|
|
@@ -1477,9 +1477,10 @@ SessionStorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: Se
|
|
|
1477
1477
|
</file>
|
|
1478
1478
|
*/
|
|
1479
1479
|
class AppContextService extends BaseApiService {
|
|
1480
|
-
constructor(http, sessionStorage) {
|
|
1480
|
+
constructor(http, localStorage, sessionStorage) {
|
|
1481
1481
|
super(http);
|
|
1482
1482
|
this.http = http;
|
|
1483
|
+
this.localStorage = localStorage;
|
|
1483
1484
|
this.sessionStorage = sessionStorage;
|
|
1484
1485
|
//Consts
|
|
1485
1486
|
this.storageKeyName = 'appContext';
|
|
@@ -1575,6 +1576,17 @@ class AppContextService extends BaseApiService {
|
|
|
1575
1576
|
clearCurrent() {
|
|
1576
1577
|
this.sessionStorage.remove(this.storageKeyName);
|
|
1577
1578
|
}
|
|
1579
|
+
//Storage
|
|
1580
|
+
clearLocalStorage() {
|
|
1581
|
+
this.localStorage.clear();
|
|
1582
|
+
}
|
|
1583
|
+
clearSessionStorage() {
|
|
1584
|
+
this.sessionStorage.clear();
|
|
1585
|
+
}
|
|
1586
|
+
clearWebStorage() {
|
|
1587
|
+
this.clearLocalStorage();
|
|
1588
|
+
this.clearSessionStorage();
|
|
1589
|
+
}
|
|
1578
1590
|
//Properties
|
|
1579
1591
|
get current() {
|
|
1580
1592
|
this.updateCurrentIfExpired();
|
|
@@ -1584,11 +1596,11 @@ class AppContextService extends BaseApiService {
|
|
|
1584
1596
|
this.setCurrentFromSession(value);
|
|
1585
1597
|
}
|
|
1586
1598
|
}
|
|
1587
|
-
AppContextService.ɵfac = function AppContextService_Factory(t) { return new (t || AppContextService)(i0.ɵɵinject(i1$3.HttpClient), i0.ɵɵinject(SessionStorageService)); };
|
|
1599
|
+
AppContextService.ɵfac = function AppContextService_Factory(t) { return new (t || AppContextService)(i0.ɵɵinject(i1$3.HttpClient), i0.ɵɵinject(LocalStorageService), i0.ɵɵinject(SessionStorageService)); };
|
|
1588
1600
|
AppContextService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AppContextService, factory: AppContextService.ɵfac });
|
|
1589
1601
|
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AppContextService, [{
|
|
1590
1602
|
type: Injectable
|
|
1591
|
-
}], function () { return [{ type: i1$3.HttpClient }, { type: SessionStorageService }]; }, null); })();
|
|
1603
|
+
}], function () { return [{ type: i1$3.HttpClient }, { type: LocalStorageService }, { type: SessionStorageService }]; }, null); })();
|
|
1592
1604
|
|
|
1593
1605
|
/*
|
|
1594
1606
|
<file>
|