2018-08-25 15:42:49 -04:00
|
|
|
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;
|
|
|
|
|
2018-09-27 17:33:10 -04:00
|
|
|
send(control: ArrayBufferView, data?: ArrayBufferView): null | Uint8Array;
|
2018-08-25 15:42:49 -04:00
|
|
|
|
2018-09-25 01:27:02 -04:00
|
|
|
print(x: string, isErr?: boolean): void;
|
2018-08-25 15:42:49 -04:00
|
|
|
|
2018-08-26 03:57:16 -04:00
|
|
|
setGlobalErrorHandler: (
|
|
|
|
handler: (
|
|
|
|
message: string,
|
|
|
|
source: string,
|
|
|
|
line: number,
|
|
|
|
col: number,
|
|
|
|
error: Error
|
|
|
|
) => void
|
|
|
|
) => void;
|
|
|
|
|
2018-08-25 15:42:49 -04:00
|
|
|
mainSource: string;
|
|
|
|
mainSourceMap: RawSourceMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
const window = globalEval("this");
|
|
|
|
export const libdeno = window.libdeno as Libdeno;
|