From 84c38f34eeb2a6f9f6786aba0f5da5eb9efa422b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Borz=C3=AC?= Date: Sat, 25 Aug 2018 21:42:49 +0200 Subject: Prevent circular imports in ts code (#576) --- js/libdeno.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 js/libdeno.ts (limited to 'js/libdeno.ts') diff --git a/js/libdeno.ts b/js/libdeno.ts new file mode 100644 index 000000000..83dc8efa0 --- /dev/null +++ b/js/libdeno.ts @@ -0,0 +1,18 @@ +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(msg: ArrayBufferView): null | Uint8Array; + + print(x: string): void; + + mainSource: string; + mainSourceMap: RawSourceMap; +} + +const window = globalEval("this"); +export const libdeno = window.libdeno as Libdeno; -- cgit v1.2.3