mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
prettier
This commit is contained in:
parent
3ced0defc4
commit
9305bf7ce3
3 changed files with 21 additions and 13 deletions
|
@ -151,7 +151,6 @@ for (const target of [Node.prototype, document]) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ const store = new IDBMapSync(locationProxy.host, {
|
||||||
|
|
||||||
await store.sync();
|
await store.sync();
|
||||||
|
|
||||||
const localStorageProxy = new Proxy(window.localStorage, {
|
const localStorageProxy = new Proxy(window.localStorage, {
|
||||||
get(target, prop) {
|
get(target, prop) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case "getItem":
|
case "getItem":
|
||||||
|
@ -68,17 +68,17 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
||||||
case "getItem":
|
case "getItem":
|
||||||
return (key: string) => {
|
return (key: string) => {
|
||||||
return target.getItem(locationProxy.host + "@" + key);
|
return target.getItem(locationProxy.host + "@" + key);
|
||||||
}
|
};
|
||||||
|
|
||||||
case "setItem":
|
case "setItem":
|
||||||
return (key: string, value: string) => {
|
return (key: string, value: string) => {
|
||||||
target.setItem(locationProxy.host + "@" + key, value);
|
target.setItem(locationProxy.host + "@" + key, value);
|
||||||
}
|
};
|
||||||
|
|
||||||
case "removeItem":
|
case "removeItem":
|
||||||
return (key: string) => {
|
return (key: string) => {
|
||||||
target.removeItem(locationProxy.host + "@" + key);
|
target.removeItem(locationProxy.host + "@" + key);
|
||||||
}
|
};
|
||||||
|
|
||||||
case "clear":
|
case "clear":
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -87,14 +87,16 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
||||||
target.removeItem(key);
|
target.removeItem(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
case "key":
|
case "key":
|
||||||
return (index: number) => {
|
return (index: number) => {
|
||||||
const keys = Object.keys(target).filter((key) => key.startsWith(locationProxy.host));
|
const keys = Object.keys(target).filter((key) =>
|
||||||
|
key.startsWith(locationProxy.host)
|
||||||
|
);
|
||||||
|
|
||||||
return target.getItem(keys[index]);
|
return target.getItem(keys[index]);
|
||||||
}
|
};
|
||||||
|
|
||||||
case "length":
|
case "length":
|
||||||
return target.length;
|
return target.length;
|
||||||
|
@ -109,8 +111,11 @@ const sessionStorageProxy = new Proxy(window.sessionStorage, {
|
||||||
},
|
},
|
||||||
|
|
||||||
defineProperty(target, property, attributes) {
|
defineProperty(target, property, attributes) {
|
||||||
target.setItem(locationProxy.host + "@" + (property as string), attributes.value);
|
target.setItem(
|
||||||
|
locationProxy.host + "@" + (property as string),
|
||||||
|
attributes.value
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -119,4 +124,4 @@ delete window.localStorage;
|
||||||
delete window.sessionStorage;
|
delete window.sessionStorage;
|
||||||
|
|
||||||
window.localStorage = localStorageProxy;
|
window.localStorage = localStorageProxy;
|
||||||
window.sessionStorage = sessionStorageProxy;
|
window.sessionStorage = sessionStorageProxy;
|
||||||
|
|
|
@ -28,7 +28,11 @@ const col = css`
|
||||||
const store = $store(
|
const store = $store(
|
||||||
{
|
{
|
||||||
url: "https://google.com",
|
url: "https://google.com",
|
||||||
wispurl: (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/",
|
wispurl:
|
||||||
|
(location.protocol === "https:" ? "wss" : "ws") +
|
||||||
|
"://" +
|
||||||
|
location.host +
|
||||||
|
"/wisp/",
|
||||||
bareurl:
|
bareurl:
|
||||||
(location.protocol === "https:" ? "https" : "http") +
|
(location.protocol === "https:" ? "https" : "http") +
|
||||||
"://" +
|
"://" +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue