mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
fix illegal invocation
This commit is contained in:
parent
ed1ba01d3a
commit
4fedcea1d4
1 changed files with 8 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
import { locationProxy } from "./location";
|
||||
|
||||
export const windowProxy = new Proxy(window, {
|
||||
get(target, prop) {
|
||||
get(target, prop, reciever) {
|
||||
const propIsString = typeof prop === "string";
|
||||
if (propIsString && prop === "location") {
|
||||
return locationProxy;
|
||||
|
@ -19,7 +19,13 @@ export const windowProxy = new Proxy(window, {
|
|||
})
|
||||
}
|
||||
|
||||
return target[prop];
|
||||
const value = Reflect.get(target, prop, reciever);
|
||||
|
||||
if (typeof value === "function") {
|
||||
return value.bind(target);
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
set(target, prop, newValue) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue