summaryrefslogtreecommitdiff
path: root/js/libdeno.ts
diff options
context:
space:
mode:
authorFrancesco Borzì <borzifrancesco@gmail.com>2018-08-25 21:42:49 +0200
committerRyan Dahl <ry@tinyclouds.org>2018-08-25 15:42:49 -0400
commit84c38f34eeb2a6f9f6786aba0f5da5eb9efa422b (patch)
tree5fb5ebec425e2736d08f6043405931109da0f7b9 /js/libdeno.ts
parent3bcf7e271f775002ba9c010ad79e321a3888187d (diff)
Prevent circular imports in ts code (#576)
Diffstat (limited to 'js/libdeno.ts')
-rw-r--r--js/libdeno.ts18
1 files changed, 18 insertions, 0 deletions
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;