diff options
author | Inteon <42113979+inteon@users.noreply.github.com> | 2021-03-18 14:10:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 14:10:27 +0100 |
commit | 20627c91364d2a992fdfaaad7c8ae86454dbc2ed (patch) | |
tree | acef1a279e92fe072da2cce2178889f6124c47c7 /runtime/js/12_io.js | |
parent | 0e70d9e59bc0e70f1921bb217ee00fc2e6facb69 (diff) |
refactor: update minimal ops & rename to buffer ops (#9719)
This commit rewrites "dispatch_minimal" into "dispatch_buffer".
It's part of an effort to unify JS interface for ops for both json
and minimal (buffer) ops.
Before this commit "minimal ops" could be either sync or async
depending on the return type from the op, but this commit changes
it to have separate signatures for sync and async ops (just like
in case of json ops).
Diffstat (limited to 'runtime/js/12_io.js')
-rw-r--r-- | runtime/js/12_io.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/js/12_io.js b/runtime/js/12_io.js index 3818069c1..09e87f990 100644 --- a/runtime/js/12_io.js +++ b/runtime/js/12_io.js @@ -7,7 +7,7 @@ ((window) => { const DEFAULT_BUFFER_SIZE = 32 * 1024; - const { sendSync, sendAsync } = window.__bootstrap.dispatchMinimal; + const { bufferOpSync, bufferOpAsync } = window.__bootstrap.dispatchBuffer; // Seek whence values. // https://golang.org/pkg/io/#pkg-constants const SeekMode = { @@ -81,7 +81,7 @@ return 0; } - const nread = sendSync("op_read", rid, buffer); + const nread = bufferOpSync("op_read_sync", rid, buffer); if (nread < 0) { throw new Error("read error"); } @@ -97,7 +97,7 @@ return 0; } - const nread = await sendAsync("op_read", rid, buffer); + const nread = await bufferOpAsync("op_read_async", rid, buffer); if (nread < 0) { throw new Error("read error"); } @@ -106,7 +106,7 @@ } function writeSync(rid, data) { - const result = sendSync("op_write", rid, data); + const result = bufferOpSync("op_write_sync", rid, data); if (result < 0) { throw new Error("write error"); } @@ -115,7 +115,7 @@ } async function write(rid, data) { - const result = await sendAsync("op_write", rid, data); + const result = await bufferOpAsync("op_write_async", rid, data); if (result < 0) { throw new Error("write error"); } |