mirror of
https://github.com/denoland/deno.git
synced 2025-07-29 08:04:00 +00:00
Remove dispatch.ts and move assignCmdId to util.ts
This commit is contained in:
parent
df8208557d
commit
421358e7a9
4 changed files with 9 additions and 39 deletions
10
js/main.ts
10
js/main.ts
|
@ -3,17 +3,9 @@
|
|||
/// <reference path="deno.d.ts" />
|
||||
import { flatbuffers } from "flatbuffers";
|
||||
import { deno as fbs } from "gen/msg_generated";
|
||||
import { assert, log } from "./util";
|
||||
import { assert, log, assignCmdId } from "./util";
|
||||
import * as runtime from "./runtime";
|
||||
|
||||
let cmdIdCounter = 0;
|
||||
function assignCmdId(): number {
|
||||
// TODO(piscisaureus) Safely re-use so they don't overflow.
|
||||
const cmdId = ++cmdIdCounter;
|
||||
assert(cmdId < 2 ** 32, "cmdId overflow");
|
||||
return cmdId;
|
||||
}
|
||||
|
||||
function startMsg(cmdId: number): Uint8Array {
|
||||
const builder = new flatbuffers.Builder();
|
||||
fbs.Start.startStart(builder);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue