| 763 | } |
| 764 | |
| 765 | sendCall(id: ImportId, path: PropertyPath, args?: RpcPayload): RpcImportHook { |
| 766 | if (this.abortReason) throw this.abortReason; |
| 767 | |
| 768 | let value: Array<any> = ["pipeline", id, path]; |
| 769 | if (args) { |
| 770 | let devalue = Devaluator.devaluate(args.value, undefined, this, args, this.encodingLevel); |
| 771 | |
| 772 | // HACK: Since the args is an array, devaluator will wrap in a second array. Need to unwrap. |
| 773 | // TODO: Clean this up somehow. |
| 774 | value.push((<Array<unknown>>devalue)[0]); |
| 775 | |
| 776 | // Serializing the payload takes ownership of all stubs within, so the payload itself does |
| 777 | // not need to be disposed. |
| 778 | } |
| 779 | this.send(["push", value]); |
| 780 | |
| 781 | let entry = new ImportTableEntry(this, this.imports.length, false); |
| 782 | this.imports.push(entry); |
| 783 | return new RpcImportHook(/*isPromise=*/true, entry); |
| 784 | } |
| 785 | |
| 786 | sendStream(id: ImportId, path: PropertyPath, args: RpcPayload) |
| 787 | : {promise: Promise<void>, size: number} { |