mirror of
https://github.com/denoland/deno.git
synced 2024-12-28 10:09:20 -05:00
d38ccfc6dc
This is a large API refactor of deno.h which replaces deno_send() and deno_set_response() with deno_respond(). It also adds a req_id parameter to the deno_recv_cb. Make writeFile/writeFileSync use it.
28 lines
695 B
TypeScript
28 lines
695 B
TypeScript
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(control: ArrayBufferView, data?: ArrayBufferView): null | Uint8Array;
|
|
|
|
print(x: string, isErr?: boolean): void;
|
|
|
|
setGlobalErrorHandler: (
|
|
handler: (
|
|
message: string,
|
|
source: string,
|
|
line: number,
|
|
col: number,
|
|
error: Error
|
|
) => void
|
|
) => void;
|
|
|
|
mainSource: string;
|
|
mainSourceMap: RawSourceMap;
|
|
}
|
|
|
|
const window = globalEval("this");
|
|
export const libdeno = window.libdeno as Libdeno;
|