First pass at fetch()

With help from Thomas Ghysels <info@thomasg.be>
This commit is contained in:
Ryan Dahl 2018-08-15 20:57:36 -04:00
parent 7b0618c20b
commit 868e8d8866
12 changed files with 659 additions and 40 deletions

View file

@ -7,6 +7,7 @@ import * as os from "./os";
import * as runtime from "./runtime";
import { libdeno } from "./globals";
import * as timers from "./timers";
import { onFetchRes } from "./fetch";
function startMsg(cmdId: number): Uint8Array {
const builder = new flatbuffers.Builder();
@ -24,6 +25,12 @@ function onMessage(ui8: Uint8Array) {
const bb = new flatbuffers.ByteBuffer(ui8);
const base = fbs.Base.getRootAsBase(bb);
switch (base.msgType()) {
case fbs.Any.FetchRes: {
const msg = new fbs.FetchRes();
assert(base.msg(msg) != null);
onFetchRes(base, msg);
break;
}
case fbs.Any.TimerReady: {
const msg = new fbs.TimerReady();
assert(base.msg(msg) != null);