fix: make screen wrapper remote-friendly again (#26620)

This restores accessibility of screen methods via remote.screen.

Fixes #26610.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2020-11-23 13:44:54 -08:00 committed by GitHub
parent 6932e02eb8
commit b1b25607ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,5 +16,23 @@ export default new Proxy({}, {
return v.bind(_screen);
}
return v;
},
ownKeys: () => {
if (_screen === undefined) {
_screen = createScreen();
}
return Reflect.ownKeys(_screen);
},
has: (target, prop: string) => {
if (_screen === undefined) {
_screen = createScreen();
}
return prop in _screen;
},
getOwnPropertyDescriptor: (target, prop: string) => {
if (_screen === undefined) {
_screen = createScreen();
}
return Reflect.getOwnPropertyDescriptor(_screen, prop);
}
});