(target: {raw: RpcStub}, prop: string | symbol, receiver: any)
| 356 | }, |
| 357 | |
| 358 | get(target: {raw: RpcStub}, prop: string | symbol, receiver: any) { |
| 359 | let stub = target.raw; |
| 360 | if (prop === RAW_STUB) { |
| 361 | return stub; |
| 362 | } else if (prop in RpcPromise.prototype) { |
| 363 | // Any method or property declared on RpcPromise (including inherited from RpcStub or |
| 364 | // Object) should pass through to the target object, as trying to turn these into RPCs will |
| 365 | // likely be problematic. |
| 366 | // |
| 367 | // Note we don't just check `prop in target` because we intentionally want to hide the |
| 368 | // properties `hook` and `path`. |
| 369 | return (<any>stub)[prop]; |
| 370 | } else if (typeof prop === "string") { |
| 371 | // Return promise for property. |
| 372 | return new RpcPromise(stub.hook, |
| 373 | stub.pathIfPromise ? [...stub.pathIfPromise, prop] : [prop]); |
| 374 | } else if (prop === Symbol.dispose && |
| 375 | (!stub.pathIfPromise || stub.pathIfPromise.length == 0)) { |
| 376 | // We only advertise Symbol.dispose on stubs and root promises, not properties. |
| 377 | return () => { |
| 378 | stub.hook.dispose(); |
| 379 | stub.hook = DISPOSED_HOOK; |
| 380 | }; |
| 381 | } else { |
| 382 | return undefined; |
| 383 | } |
| 384 | }, |
| 385 | |
| 386 | has(target: {raw: RpcStub}, prop: string | symbol) { |
| 387 | let stub = target.raw; |
nothing calls this directly
no test coverage detected