@utogether/utils 3.0.0-beta.16 → 3.0.0-beta.18

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/dist/utils.es.js CHANGED
@@ -21,22 +21,26 @@ class sessionStorageProxy {
21
21
  }
22
22
  // 存
23
23
  setItem(l, h) {
24
- this.storage.setItem(this.getKey(l), JSON.stringify(h));
24
+ var o;
25
+ (o = this.storage) == null || o.setItem(this.getKey(l), JSON.stringify(h || null));
25
26
  }
26
27
  // 取
27
28
  getItem(l) {
28
- return JSON.parse(this.storage.getItem(this.getKey(l)));
29
+ var h;
30
+ return !l || !this.getKey(l) ? "" : JSON.parse((h = this.storage) == null ? void 0 : h.getItem(this.getKey(l)));
29
31
  }
30
32
  // 删
31
33
  removeItem(l) {
32
- this.storage.removeItem(this.getKey(l));
34
+ var h;
35
+ (h = this.storage) == null || h.removeItem(this.getKey(l));
33
36
  }
34
37
  getKey(l) {
35
38
  return this.prefix ? this.prefix + "_" + l : l;
36
39
  }
37
40
  // 清空
38
41
  clear() {
39
- this.storage.clear();
42
+ var l;
43
+ (l = this.storage) == null || l.clear();
40
44
  }
41
45
  }
42
46
  class localStorageProxy extends sessionStorageProxy {
@@ -72,24 +76,16 @@ class localforageProxy {
72
76
  let window$1;
73
77
  window$1 || (window$1 = {
74
78
  sessionStorage: {
75
- getItem: () => {
76
- },
77
- setItem: () => {
78
- },
79
- removeItem: () => {
80
- },
81
- clear: () => {
82
- }
79
+ // getItem: () => {},
80
+ // setItem: () => {},
81
+ // removeItem: () => {},
82
+ // clear: () => {},
83
83
  },
84
84
  localStorage: {
85
- getItem: () => {
86
- },
87
- setItem: () => {
88
- },
89
- removeItem: () => {
90
- },
91
- clear: () => {
92
- }
85
+ // getItem: () => {},
86
+ // setItem: () => {},
87
+ // removeItem: () => {},
88
+ // clear: () => {},
93
89
  }
94
90
  });
95
91
  const storageSession = new sessionStorageProxy(window$1 == null ? void 0 : window$1.sessionStorage), storageLocal = new localStorageProxy(window$1 == null ? void 0 : window$1.localStorage), dbstorage = new localforageProxy();