diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2018-11-09 15:07:48 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-09 08:36:31 -0800 |
commit | 172f5a51332b24c1027ea0f22d7e71b516dcd7d5 (patch) | |
tree | 73b6ff5d4e75e4b3bdabb4f1f0204199520f4c5a | |
parent | 1f2c92c7c88ce6619624520ec7e6b9a1f57d445b (diff) |
Cleanups for runtime lib declarations.
-rw-r--r-- | js/io.ts | 9 | ||||
-rw-r--r-- | js/libdeno.ts | 1 | ||||
-rw-r--r-- | js/resources.ts | 9 |
3 files changed, 12 insertions, 7 deletions
@@ -116,12 +116,11 @@ export async function copy(dst: Writer, src: Reader): Promise<number> { return n; } -/** - * Turns `r` into async iterator. +/** Turns `r` into async iterator. * - * for await (const chunk of readerIterator(reader)) { - * console.log(chunk) - * } + * for await (const chunk of readerIterator(reader)) { + * console.log(chunk) + * } */ export function toAsyncIterator(r: Reader): AsyncIterableIterator<Uint8Array> { const b = new Uint8Array(1024); diff --git a/js/libdeno.ts b/js/libdeno.ts index 9745365b0..c61027324 100644 --- a/js/libdeno.ts +++ b/js/libdeno.ts @@ -45,4 +45,5 @@ interface Libdeno { } const window = globalEval("this"); +// @internal export const libdeno = window.libdeno as Libdeno; diff --git a/js/resources.ts b/js/resources.ts index a28270fca..c40d52b4e 100644 --- a/js/resources.ts +++ b/js/resources.ts @@ -4,7 +4,12 @@ import * as flatbuffers from "./flatbuffers"; import { assert } from "./util"; import * as dispatch from "./dispatch"; -export function resources(): { [key: number]: string } { +export type ResourceMap = { [rid: number]: string }; + +/** Returns a map of open _file like_ resource ids along with their string + * representation. + */ +export function resources(): ResourceMap { const builder = flatbuffers.createBuilder(); msg.Resources.startResources(builder); const inner = msg.Resource.endResource(builder); @@ -14,7 +19,7 @@ export function resources(): { [key: number]: string } { const res = new msg.ResourcesRes(); assert(baseRes!.inner(res) !== null); - const resources: { [key: number]: string } = {}; + const resources = {} as ResourceMap; for (let i = 0; i < res.resourcesLength(); i++) { const item = res.resources(i)!; |