diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2019-08-22 22:30:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-22 22:30:14 -0700 |
| commit | bc467b265fbe06ace24f5d9536bd8eb36ae4a601 (patch) | |
| tree | 6c1761c852398a63fe31fc912841b449fe3851c3 /js/dispatch.ts | |
| parent | 47c216317f8eb5bf277663a732a79f6b07ba79ef (diff) | |
introduce JSON serialization for ops (#2799)
Converts env(), exit(), execPath(), utime() and utimeSync() to use JSON
instead of flatbuffers.
Diffstat (limited to 'js/dispatch.ts')
| -rw-r--r-- | js/dispatch.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/js/dispatch.ts b/js/dispatch.ts index 423469d38..0c5c59553 100644 --- a/js/dispatch.ts +++ b/js/dispatch.ts @@ -1,20 +1,29 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import * as minimal from "./dispatch_minimal"; import * as flatbuffers from "./dispatch_flatbuffers"; +import * as json from "./dispatch_json"; // These consts are shared with Rust. Update with care. export const OP_FLATBUFFER = 44; export const OP_READ = 1; export const OP_WRITE = 2; +export const OP_EXIT = 3; +export const OP_IS_TTY = 4; +export const OP_ENV = 5; +export const OP_EXEC_PATH = 6; +export const OP_UTIME = 7; -export function handleAsyncMsgFromRust(opId: number, ui8: Uint8Array): void { +export function asyncMsgFromRust(opId: number, ui8: Uint8Array): void { switch (opId) { case OP_FLATBUFFER: - flatbuffers.handleAsyncMsgFromRust(opId, ui8); + flatbuffers.asyncMsgFromRust(opId, ui8); break; case OP_WRITE: case OP_READ: - minimal.handleAsyncMsgFromRust(opId, ui8); + minimal.asyncMsgFromRust(opId, ui8); + break; + case OP_UTIME: + json.asyncMsgFromRust(opId, ui8); break; default: throw Error("bad opId"); |
