Skip to content

Commit

Permalink
Cleanups for runtime lib declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored and ry committed Nov 9, 2018
1 parent 1f2c92c commit 172f5a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 4 additions & 5 deletions js/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions js/libdeno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ interface Libdeno {
}

const window = globalEval("this");
// @internal
export const libdeno = window.libdeno as Libdeno;
9 changes: 7 additions & 2 deletions js/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)!;
Expand Down

0 comments on commit 172f5a5

Please sign in to comment.