actually prettier

This commit is contained in:
Toshit Chawda 2024-07-14 16:22:34 -07:00
parent fb53b44869
commit 56767f5b31
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
41 changed files with 1914 additions and 1919 deletions

View file

@ -1,47 +1,47 @@
import { locationProxy } from "./location";
import { locationProxy } from "./location"
export const windowProxy = new Proxy(window, {
get(target, prop) {
const propIsString = typeof prop === "string";
if (propIsString && prop === "location") {
return locationProxy;
} else if (
propIsString &&
["window", "top", "parent", "self", "globalThis"].includes(prop)
) {
return windowProxy;
} else if (propIsString && prop === "$scramjet") {
return;
} else if (propIsString && prop === "addEventListener") {
console.log("addEventListener getteetetetetet");
get(target, prop) {
const propIsString = typeof prop === "string"
if (propIsString && prop === "location") {
return locationProxy
} else if (
propIsString &&
["window", "top", "parent", "self", "globalThis"].includes(prop)
) {
return windowProxy
} else if (propIsString && prop === "$scramjet") {
return
} else if (propIsString && prop === "addEventListener") {
console.log("addEventListener getteetetetetet")
return new Proxy(window.addEventListener, {
apply(target1, thisArg, argArray) {
window.addEventListener(argArray[0], argArray[1]);
},
});
}
return new Proxy(window.addEventListener, {
apply(target1, thisArg, argArray) {
window.addEventListener(argArray[0], argArray[1])
},
})
}
const value = Reflect.get(target, prop);
const value = Reflect.get(target, prop)
if (typeof value === "function") {
return value.bind(target);
}
if (typeof value === "function") {
return value.bind(target)
}
return value;
},
return value
},
set(target, prop, newValue) {
// ensures that no apis are overwritten
if (
typeof prop === "string" &&
["window", "top", "parent", "self", "globalThis", "location"].includes(
prop,
)
) {
return false;
}
set(target, prop, newValue) {
// ensures that no apis are overwritten
if (
typeof prop === "string" &&
["window", "top", "parent", "self", "globalThis", "location"].includes(
prop
)
) {
return false
}
return Reflect.set(target, prop, newValue);
},
});
return Reflect.set(target, prop, newValue)
},
})