diff options
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/globals.ts | 3 | ||||
-rw-r--r-- | cli/js/ops/dispatch_json.ts | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/cli/js/globals.ts b/cli/js/globals.ts index 8d122878f..21ce7e619 100644 --- a/cli/js/globals.ts +++ b/cli/js/globals.ts @@ -97,6 +97,9 @@ declare global { evalContext(code: string): [any, EvalErrorInfo | null]; formatError: (e: Error) => string; + + decode(bytes: Uint8Array): string; + encode(text: string): Uint8Array; } // Only `var` variables show up in the `globalThis` type when doing a global diff --git a/cli/js/ops/dispatch_json.ts b/cli/js/ops/dispatch_json.ts index 4aa1f6b8b..9ff0f13f5 100644 --- a/cli/js/ops/dispatch_json.ts +++ b/cli/js/ops/dispatch_json.ts @@ -1,6 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import * as util from "../util.ts"; -import { TextEncoder, TextDecoder } from "../web/text_encoding.ts"; import { core } from "../core.ts"; import { OPS_CACHE } from "../runtime.ts"; import { ErrorKind, getErrorClass } from "../errors.ts"; @@ -30,13 +29,13 @@ function nextPromiseId(): number { } function decode(ui8: Uint8Array): JsonResponse { - const s = new TextDecoder().decode(ui8); + const s = core.decode(ui8); return JSON.parse(s) as JsonResponse; } function encode(args: object): Uint8Array { const s = JSON.stringify(args); - return new TextEncoder().encode(s); + return core.encode(s); } function unwrapResponse(res: JsonResponse): Ok { |