summaryrefslogtreecommitdiff
path: root/js/deno.d.ts
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-07-09 03:35:34 +0200
committerBert Belder <bertbelder@gmail.com>2018-07-12 21:26:38 +0200
commit24b0e91d8096f84a114f662e3eb42c83d0d3878d (patch)
treeacd9ae306618276020e75450c064ead463e64387 /js/deno.d.ts
parentbbcd4c8dd33121868d82123a3d36e3df282af45f (diff)
Move buffers between V8 and native
* send()/recv() now operate on TypedArrays rather than ArrayBuffers. * Remove a copy (through ArrayBuffer.slice()) from the send path. * Remove a copy (through v8::ArrayBuffer::New()) from the return path. * After moving a buffer from JS to native, the ArrayBuffer object and it's views are made inaccessible ('neutered'). * `struct deno_buf` now holds two [ptr, length] tuples, one for the actual memory allocation, and one for the logical data contained therein. This is necessary because flatbuffers fills it's buffer bottom-up, so the serialized blob doesn't start at beginning of the buffer, but somewhere in the middle.
Diffstat (limited to 'js/deno.d.ts')
-rw-r--r--js/deno.d.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/js/deno.d.ts b/js/deno.d.ts
index f554135bc..a54dab851 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 = (msg: ArrayBuffer) => void;
+type MessageCallback = (msg: Uint8Array) => void;
interface Deno {
recv(cb: MessageCallback): void;
- send(msg: ArrayBuffer): null | ArrayBuffer;
+ send(msg: ArrayBufferView): null | Uint8Array;
print(x: string): void;
}