diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/deno.d.ts | 4 | ||||
-rw-r--r-- | js/main.ts | 2 | ||||
-rw-r--r-- | js/mock_runtime.js | 14 |
3 files changed, 9 insertions, 11 deletions
diff --git a/js/deno.d.ts b/js/deno.d.ts index 748ee32ce..f554135bc 100644 --- a/js/deno.d.ts +++ b/js/deno.d.ts @@ -1,10 +1,10 @@ // Copyright 2018 Ryan Dahl <ry@tinyclouds.org> // All rights reserved. MIT License. -type MessageCallback = (channel: string, msg: ArrayBuffer) => void; +type MessageCallback = (msg: ArrayBuffer) => void; interface Deno { recv(cb: MessageCallback): void; - send(channel: string, msg: ArrayBuffer): null | ArrayBuffer; + send(msg: ArrayBuffer): null | ArrayBuffer; print(x: string): void; } diff --git a/js/main.ts b/js/main.ts index 6ba38f669..01c3ab9fb 100644 --- a/js/main.ts +++ b/js/main.ts @@ -27,7 +27,7 @@ window["denoMain"] = () => { // First we send an empty "Start" message to let the privlaged side know we // are ready. The response should be a "StartRes" message containing the CLI // argv and other info. - const res = deno.send("start", startMsg()); + const res = deno.send(startMsg()); // TODO(ry) Remove this conditional once main.rs gets up to speed. if (res == null) { diff --git a/js/mock_runtime.js b/js/mock_runtime.js index 666cabf45..66a34657e 100644 --- a/js/mock_runtime.js +++ b/js/mock_runtime.js @@ -28,15 +28,13 @@ global.TypedArraySnapshots = () => { }; global.SendSuccess = () => { - deno.recv((channel, msg) => { - assert(channel === "SendSuccess"); + deno.recv(msg => { deno.print("SendSuccess: ok"); }); }; global.SendByteLength = () => { - deno.recv((channel, msg) => { - assert(channel === "SendByteLength"); + deno.recv(msg => { assert(msg instanceof ArrayBuffer); assert(msg.byteLength === 3); }); @@ -45,16 +43,16 @@ global.SendByteLength = () => { global.RecvReturnEmpty = () => { const ui8 = new Uint8Array("abc".split("").map(c => c.charCodeAt(0))); const ab = typedArrayToArrayBuffer(ui8); - let r = deno.send("RecvReturnEmpty", ab); + let r = deno.send(ab); assert(r == null); - r = deno.send("RecvReturnEmpty", ab); + r = deno.send(ab); assert(r == null); }; global.RecvReturnBar = () => { const ui8 = new Uint8Array("abc".split("").map(c => c.charCodeAt(0))); const ab = typedArrayToArrayBuffer(ui8); - const r = deno.send("RecvReturnBar", ab); + const r = deno.send(ab); assert(r instanceof ArrayBuffer); assert(r.byteLength === 3); const rui8 = new Uint8Array(r); @@ -84,7 +82,7 @@ global.ErrorHandling = () => { assert(line === 3); assert(col === 1); assert(error instanceof Error); - deno.send("ErrorHandling", typedArrayToArrayBuffer(new Uint8Array([42]))); + deno.send(typedArrayToArrayBuffer(new Uint8Array([42]))); }; eval("\n\n notdefined()\n//# sourceURL=helloworld.js"); }; |