mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
delete useless globals
This commit is contained in:
parent
4ce4226afa
commit
7f0663425a
5 changed files with 30 additions and 31 deletions
|
@ -1,10 +1,12 @@
|
|||
const windowProxy = new Proxy(window, {
|
||||
import { locationProxy } from "./location";
|
||||
|
||||
export const windowProxy = new Proxy(window, {
|
||||
get(target, prop) {
|
||||
const propIsString = typeof prop === "string";
|
||||
if (propIsString && prop === "location") {
|
||||
return target.__location;
|
||||
return locationProxy;
|
||||
} else if (propIsString && ["window", "top", "parent", "self", "globalThis"].includes(prop)) {
|
||||
return target.__window;
|
||||
return windowProxy;
|
||||
}
|
||||
|
||||
return target[prop];
|
||||
|
@ -19,5 +21,3 @@ const windowProxy = new Proxy(window, {
|
|||
return Reflect.set(target, prop, newValue);
|
||||
},
|
||||
});
|
||||
|
||||
window.__window = windowProxy;
|
Loading…
Add table
Add a link
Reference in a new issue