|
|
@ -6,7 +6,7 @@ function monkeyPatch(name, parentObj, patches) {
|
|
|
|
const handler = {
|
|
|
|
const handler = {
|
|
|
|
apply: (target, thisArg, [ctx, args]) => {
|
|
|
|
apply: (target, thisArg, [ctx, args]) => {
|
|
|
|
if (before !== undefined) before.apply(ctx, args);
|
|
|
|
if (before !== undefined) before.apply(ctx, args);
|
|
|
|
res = (patches["instead"] !== undefined) ? instead.apply(ctx, [target.bind(ctx), ...args]) : target.apply(ctx, [...args])
|
|
|
|
res = (patches["instead"] !== undefined) ? instead.apply(ctx, [target.bind(ctx), ...args]) : target.apply(ctx, args)
|
|
|
|
if (after === undefined) return res
|
|
|
|
if (after === undefined) return res
|
|
|
|
return after.apply(ctx, [res].concat(args));
|
|
|
|
return after.apply(ctx, [res].concat(args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|