diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-21 18:53:53 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-21 18:53:53 -0400 |
commit | 9a6621659937c55c6005a1fa6ce9641a4ceff385 (patch) | |
tree | 723763263c610069635db80252d9e638a28052b0 /os.ts | |
parent | 8e2e17cdbe02847b19d8bc2002ba713d18e291b9 (diff) |
Add globals.ts
Diffstat (limited to 'os.ts')
-rw-r--r-- | os.ts | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -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(); |