1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-14 16:33:45 -05:00
denoland-deno/js/libdeno.ts
2018-10-04 00:25:55 -04:00

28 lines
695 B
TypeScript

import { RawSourceMap } from "./types";
import { globalEval } from "./global_eval";
// The libdeno functions are moved so that users can't access them.
type MessageCallback = (msg: Uint8Array) => void;
interface Libdeno {
recv(cb: MessageCallback): void;
send(control: ArrayBufferView, data?: ArrayBufferView): null | Uint8Array;
print(x: string, isErr?: boolean): void;
setGlobalErrorHandler: (
handler: (
message: string,
source: string,
line: number,
col: number,
error: Error
) => void
) => void;
mainSource: string;
mainSourceMap: RawSourceMap;
}
const window = globalEval("this");
export const libdeno = window.libdeno as Libdeno;