mirror of
https://github.com/denoland/deno.git
synced 2025-07-28 23:53:53 +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
|
@ -20,6 +20,14 @@ export function assert(cond: boolean, msg = "assert") {
|
|||
}
|
||||
}
|
||||
|
||||
let cmdIdCounter = 0;
|
||||
export function assignCmdId(): number {
|
||||
// TODO(piscisaureus) Safely re-use so they don't overflow.
|
||||
const cmdId = ++cmdIdCounter;
|
||||
assert(cmdId < 2 ** 32, "cmdId overflow");
|
||||
return cmdId;
|
||||
}
|
||||
|
||||
export function typedArrayToArrayBuffer(ta: TypedArray): ArrayBuffer {
|
||||
const ab = ta.buffer.slice(ta.byteOffset, ta.byteOffset + ta.byteLength);
|
||||
return ab as ArrayBuffer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue