Remove dispatch.ts and move assignCmdId to util.ts

This commit is contained in:
Ryan Dahl 2018-08-01 12:36:17 -04:00
parent df8208557d
commit 421358e7a9
4 changed files with 9 additions and 39 deletions

View file

@ -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);