mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
the js
This commit is contained in:
parent
212a9510d5
commit
ba42d3083e
2 changed files with 22 additions and 8 deletions
|
@ -10,7 +10,7 @@ const FunctionProxy = new Proxy(Function, {
|
|||
},
|
||||
apply(target, thisArg, argArray) {
|
||||
if (argArray.length === 1) {
|
||||
return Reflect.apply(target, undefined, rewriteJs(argArray[0]));
|
||||
return Reflect.apply(target, undefined, [rewriteJs(argArray[0])]);
|
||||
} else {
|
||||
return Reflect.apply(target, undefined, [...argArray.map((x, index) => index === argArray.length - 1), rewriteJs(argArray[argArray.length - 1])])
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ delete window.Function;
|
|||
|
||||
window.Function = FunctionProxy;
|
||||
|
||||
delete window.eval;
|
||||
|
||||
// since the function proxy is already rewriting the js we can just reuse it for the eval proxy
|
||||
|
||||
window.eval = (str: string) => window.Function(str);
|
||||
window.eval = new Proxy(window.eval, {
|
||||
apply(target, thisArg, argArray) {
|
||||
return Reflect.apply(target, thisArg, [rewriteJs(argArray[0])]);
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue