*add new helper maybeGetAsyncProperty to process the kernel client proxies if needed
This commit is contained in:
parent
6323bc6b29
commit
5e4617ac55
12
src/util.ts
12
src/util.ts
|
@ -125,3 +125,15 @@ export function setupStream(stream: any) {
|
||||||
|
|
||||||
return stream[RPC_PROTOCOL_SYMBOL];
|
return stream[RPC_PROTOCOL_SYMBOL];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function maybeGetAsyncProperty(object: any) {
|
||||||
|
if (typeof object === "function") {
|
||||||
|
object = object();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPromise(object)) {
|
||||||
|
object = await object;
|
||||||
|
}
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue