1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00
denoland-deno/js/deno.d.ts
Bert Belder 24b0e91d80
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.
2018-07-12 21:26:38 +02:00

11 lines
290 B
TypeScript

// Copyright 2018 Ryan Dahl <ry@tinyclouds.org>
// All rights reserved. MIT License.
type MessageCallback = (msg: Uint8Array) => void;
interface Deno {
recv(cb: MessageCallback): void;
send(msg: ArrayBufferView): null | Uint8Array;
print(x: string): void;
}
declare let deno: Deno;