diff --git a/src/client/window.ts b/src/client/window.ts index 5f649c7..de92a93 100644 --- a/src/client/window.ts +++ b/src/client/window.ts @@ -15,12 +15,6 @@ export const windowProxy = new Proxy(window, { return window.parent; } else if (propIsString && prop === "$scramjet") { return; - } else if (propIsString && prop === "addEventListener") { - return new Proxy(window.addEventListener, { - apply(target1, thisArg, argArray) { - window.addEventListener(argArray[0], argArray[1]); - }, - }); } const value = Reflect.get(target, prop); @@ -107,3 +101,15 @@ Function.prototype.call = new Proxy(Function.prototype.call, { return Reflect.apply(target, thisArg, argArray); }, }); + +Function.prototype.bind = new Proxy(Function.prototype.bind, { + apply(target, thisArg, argArray) { + if (argArray[0] === windowProxy) { + argArray[0] = window; + } else if (argArray[0] === documentProxy) { + argArray[0] = document; + } + + return Reflect.apply(target, thisArg, argArray); + }, +});