mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
fix Storage logic
This commit is contained in:
parent
4b6261188e
commit
8a3d45dc54
1 changed files with 9 additions and 6 deletions
|
@ -8,10 +8,7 @@ const store = new IDBMapSync(locationProxy.host, {
|
||||||
|
|
||||||
await store.sync();
|
await store.sync();
|
||||||
|
|
||||||
delete window.localStorage;
|
const localStorageProxy = new Proxy(window.localStorage, {
|
||||||
delete window.sessionStorage;
|
|
||||||
|
|
||||||
window.localStorage = new Proxy(localStorage, {
|
|
||||||
get(target, prop) {
|
get(target, prop) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case "getItem":
|
case "getItem":
|
||||||
|
@ -65,7 +62,7 @@ window.localStorage = new Proxy(localStorage, {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
window.sessionStorage = new Proxy(sessionStorage, {
|
const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
||||||
get(target, prop) {
|
get(target, prop) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case "getItem":
|
case "getItem":
|
||||||
|
@ -116,4 +113,10 @@ window.sessionStorage = new Proxy(sessionStorage, {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
delete window.localStorage;
|
||||||
|
delete window.sessionStorage;
|
||||||
|
|
||||||
|
window.localStorage = localStorageProxy;
|
||||||
|
window.sessionStorage = sessionStorageProxy;
|
Loading…
Add table
Add a link
Reference in a new issue