summaryrefslogtreecommitdiff
path: root/cli/js/ops/dispatch_minimal.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-06-21 16:34:43 +0200
committerGitHub <noreply@github.com>2020-06-21 16:34:43 +0200
commit79adc7b000a807caff01a3639b18cb91aef9bd9c (patch)
tree8592baf9a2d88aea7a55f55903739b63bd23fded /cli/js/ops/dispatch_minimal.ts
parent86448fd9aaa9d70078f7928c9ea1d5af2679ea08 (diff)
core: add Deno.core.dispatchByName (#6395)
This commit adds alternate dispatch method to core JS API. "Deno.core.dispatchByName()" works like "Deno.core.dispatch()", but takes op name instead of op id as a first argument.
Diffstat (limited to 'cli/js/ops/dispatch_minimal.ts')
-rw-r--r--cli/js/ops/dispatch_minimal.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/js/ops/dispatch_minimal.ts b/cli/js/ops/dispatch_minimal.ts
index 570463583..0d1dac44e 100644
--- a/cli/js/ops/dispatch_minimal.ts
+++ b/cli/js/ops/dispatch_minimal.ts
@@ -83,7 +83,7 @@ export function asyncMsgFromRust(ui8: Uint8Array): void {
}
export async function sendAsyncMinimal(
- opId: number,
+ opName: string,
arg: number,
zeroCopy: Uint8Array
): Promise<number> {
@@ -92,7 +92,7 @@ export async function sendAsyncMinimal(
scratch32[1] = arg;
scratch32[2] = 0; // result
const promise = util.createResolvable<RecordMinimal>();
- const buf = core.dispatch(opId, scratchBytes, zeroCopy);
+ const buf = core.dispatchByName(opName, scratchBytes, zeroCopy);
if (buf) {
const record = recordFromBufMinimal(buf);
// Sync result.
@@ -107,13 +107,13 @@ export async function sendAsyncMinimal(
}
export function sendSyncMinimal(
- opId: number,
+ opName: string,
arg: number,
zeroCopy: Uint8Array
): number {
scratch32[0] = 0; // promiseId 0 indicates sync
scratch32[1] = arg;
- const res = core.dispatch(opId, scratchBytes, zeroCopy)!;
+ const res = core.dispatchByName(opName, scratchBytes, zeroCopy)!;
const resRecord = recordFromBufMinimal(res);
return unwrapResponse(resRecord);
}