mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
reorg: remove dispatch.ts, move signals, factor out web utils (#4316)
- moves signal definition from "cli/js/process.ts" to "cli/js/signals.ts" - removes "cli/js/dispatch.ts" - removes "cli/js/types.ts" - moves web specific utilities to "cli/js/web/util.ts"
This commit is contained in:
parent
99a0c6df79
commit
2d1b39bef3
20 changed files with 188 additions and 199 deletions
|
@ -1,6 +1,7 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { core } from "./core.ts";
|
||||
import * as dispatch from "./dispatch.ts";
|
||||
import * as dispatchMinimal from "./ops/dispatch_minimal.ts";
|
||||
import * as dispatchJson from "./ops/dispatch_json.ts";
|
||||
import { assert } from "./util.ts";
|
||||
import * as util from "./util.ts";
|
||||
import { setBuildInfo } from "./build.ts";
|
||||
|
@ -11,12 +12,22 @@ import { Start, start as startOp } from "./ops/runtime.ts";
|
|||
|
||||
export let OPS_CACHE: { [name: string]: number };
|
||||
|
||||
function getAsyncHandler(opName: string): (msg: Uint8Array) => void {
|
||||
switch (opName) {
|
||||
case "op_write":
|
||||
case "op_read":
|
||||
return dispatchMinimal.asyncMsgFromRust;
|
||||
default:
|
||||
return dispatchJson.asyncMsgFromRust;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(bartlomieju): temporary solution, must be fixed when moving
|
||||
// dispatches to separate crates
|
||||
export function initOps(): void {
|
||||
OPS_CACHE = core.ops();
|
||||
for (const [name, opId] of Object.entries(OPS_CACHE)) {
|
||||
core.setAsyncHandler(opId, dispatch.getAsyncHandler(name));
|
||||
core.setAsyncHandler(opId, getAsyncHandler(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue