mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 07:20:02 -04:00
proxy self.event
This commit is contained in:
parent
d3a86ab133
commit
d864c0061a
1 changed files with 14 additions and 1 deletions
|
@ -46,6 +46,8 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
},
|
||||
};
|
||||
|
||||
// TODO! window.event not proxied
|
||||
|
||||
function wraplistener(listener: (...args: any) => any) {
|
||||
return new Proxy(listener, {
|
||||
apply(target, thisArg, argArray) {
|
||||
|
@ -75,7 +77,18 @@ export default function (client: ScramjetClient, self: Self) {
|
|||
}
|
||||
}
|
||||
|
||||
return Reflect.apply(target, thisArg, argArray);
|
||||
Object.defineProperty(self, "event", {
|
||||
get() {
|
||||
return argArray[0];
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
let rv = Reflect.apply(target, thisArg, argArray);
|
||||
|
||||
delete self.event;
|
||||
|
||||
return rv;
|
||||
},
|
||||
getOwnPropertyDescriptor: getOwnPropertyDescriptorHandler,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue