summaryrefslogtreecommitdiff
path: root/os.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-21 18:53:53 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-21 18:53:53 -0400
commit9a6621659937c55c6005a1fa6ce9641a4ceff385 (patch)
tree723763263c610069635db80252d9e638a28052b0 /os.ts
parent8e2e17cdbe02847b19d8bc2002ba713d18e291b9 (diff)
Add globals.ts
Diffstat (limited to 'os.ts')
-rw-r--r--os.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/os.ts b/os.ts
index 3d3639dc3..82baac25d 100644
--- a/os.ts
+++ b/os.ts
@@ -1,5 +1,6 @@
import { main as pb } from "./msg.pb";
-import { TypedArray, ModuleInfo } from "./types";
+import { ModuleInfo } from "./types";
+import { typedArrayToArrayBuffer } from "./util";
export function exit(code = 0): void {
sendMsgFromObject({
@@ -28,11 +29,6 @@ export function sourceCodeCache(
throwOnError(res);
}
-function typedArrayToArrayBuffer(ta: TypedArray): ArrayBuffer {
- const ab = ta.buffer.slice(ta.byteOffset, ta.byteOffset + ta.byteLength);
- return ab as ArrayBuffer;
-}
-
export function sendMsgFromObject(obj: pb.IMsg): null | pb.Msg {
const msg = pb.Msg.fromObject(obj);
const ui8 = pb.Msg.encode(msg).finish();