-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStorage.js
35 lines (27 loc) · 902 Bytes
/
Storage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
export default class Storage {
static prefix = "";
static cacheExists(key) {
return window.sessionStorage.hasOwnProperty(this.prefix + key);
}
static storeExists(key) {
return window.localStorage.hasOwnProperty(this.prefix + key);
}
static cache(key, value) {
window.sessionStorage.setItem(this.prefix + key, value);
}
static store(key, value) {
window.localStorage.setItem(this.prefix + key, value);
}
static getCache(key) {
return window.sessionStorage.getItem(this.prefix + key);
}
static getStore(key) {
return window.localStorage.getItem(this.prefix + key);
}
static deleteCache(key) {
window.sessionStorage.removeItem(this.prefix + key);
}
static deleteStore(key) {
window.localStorage.removeItem(this.prefix + key);
}
}