summaryrefslogtreecommitdiff
path: root/js/globals.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-08-09 13:24:03 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-08-09 14:27:46 -0700
commit040a0426796f0249bf0ca61ebbb2aae0b4993e94 (patch)
tree689c78775ebb83f9b251348399793c0adb524cb8 /js/globals.ts
parentfb87cb38eca7a2d490c3e70738407dc6538e80d3 (diff)
Add TextEncoder/TextDecoder support.
Fixes #470 This commit increases size: out/release/gen/bundle/main.js 7.3M -> 7.9M out/release/gen/bundle/main.js.map 11M -> 12M out/release/gen/snapshot_deno.bin 34M -> 37M out/release/deno 49M -> 53M Note the amount in the JS code added is quite small: 4.0K node_modules/text-encoding/index.js 4.0K node_modules/@types/text-encoding/index.d.ts 4.0K js/text_encoding.ts Unclear to me what is causing the jump in snapshot size.
Diffstat (limited to 'js/globals.ts')
-rw-r--r--js/globals.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/js/globals.ts b/js/globals.ts
index f17d2f33a..a6f1b0927 100644
--- a/js/globals.ts
+++ b/js/globals.ts
@@ -3,6 +3,7 @@
import { Console } from "./console";
import { RawSourceMap } from "./types";
import * as timers from "./timers";
+import { TextEncoder, TextDecoder } from "./text_encoding";
declare global {
interface Window {
@@ -16,6 +17,11 @@ declare global {
const console: Console;
const window: Window;
+
+ // tslint:disable:variable-name
+ let TextEncoder: TextEncoder;
+ let TextDecoder: TextDecoder;
+ // tslint:enable:variable-name
}
// If you use the eval function indirectly, by invoking it via a reference
@@ -49,10 +55,8 @@ window.clearTimeout = timers.clearTimer;
window.clearInterval = timers.clearTimer;
window.console = new Console(libdeno.print);
+window.TextEncoder = TextEncoder;
+window.TextDecoder = TextDecoder;
// import { fetch } from "./fetch";
// window["fetch"] = fetch;
-
-// import { TextEncoder, TextDecoder } from "text-encoding";
-// window["TextEncoder"] = TextEncoder;
-// window["TextDecoder"] = TextDecoder;