mirror of
https://github.com/denoland/deno.git
synced 2024-12-28 10:09:20 -05:00
24b0e91d80
* 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.
11 lines
290 B
TypeScript
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;
|