summaryrefslogtreecommitdiff
path: root/js/libdeno.ts
diff options
context:
space:
mode:
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;