Skip to content

Commit ecfca97

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

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

lib/node/node-wsh.js

Lines changed: 24 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,26 @@ class RemoteObject {
269269
this.#proxy = proxy;
270270
}
271271
}
272+
273+
class RemoteFunction extends Function {
274+
275+
#ref;
276+
#proxy;
277+
278+
constructor( ref) {
279+
super();
280+
this.#ref = ref;
281+
}
282+
283+
get ref() {
284+
return this.#ref;
285+
}
286+
287+
get proxy() {
288+
return this.#proxy;
289+
}
290+
291+
set proxy( proxy) {
292+
this.#proxy = proxy;
293+
}
294+
}

0 commit comments

Comments
 (0)