Skip to content

Commit 0ed7a66

Browse files
committed
replace function() {} with class RemoteFunction
1 parent 62fd831 commit 0ed7a66

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

lib/node/node-wsh.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class WindowsScriptingHost extends EventEmitter {
141141
if( existingProxy)
142142
return existingProxy;
143143

144-
const target = handler === this.#objectHandler? new RemoteObject( ref): function() {};
144+
const target = handler === this.#objectHandler? new RemoteObject( ref): new RemoteFunction( ref);
145145
const newProxy = new Proxy( target, handler);
146146
target.proxy = newProxy;
147147
this.#ref2proxy.set( ref, new WeakRef( newProxy)); // may be overwriting a dead WeakRef
@@ -269,3 +269,25 @@ class RemoteObject {
269269
this.#proxy = proxy;
270270
}
271271
}
272+
273+
class RemoteFunction extends Function {
274+
275+
#ref;
276+
#proxy;
277+
278+
constructor( ref) {
279+
this.#ref = ref;
280+
}
281+
282+
get ref() {
283+
return this.#ref;
284+
}
285+
286+
get proxy() {
287+
return this.#proxy;
288+
}
289+
290+
set proxy( proxy) {
291+
this.#proxy = proxy;
292+
}
293+
}

0 commit comments

Comments
 (0)