chore: move //src/js to //js

refs: #285
This commit is contained in:
Yoshiya Hinosawa 2018-07-01 23:37:10 +09:00 committed by Ryan Dahl
parent 9528ee4a42
commit ea35281d63
16 changed files with 25 additions and 25 deletions

41
js/main.ts Normal file
View file

@ -0,0 +1,41 @@
/// <reference path="deno.d.ts" />
import { deno as pb } from "./msg.pb";
import * as ts from "typescript";
const globalEval = eval;
const window = globalEval("this");
window["denoMain"] = () => {
deno.print(`ts.version: ${ts.version}`);
const res = deno.pub("startDeno2", emptyArrayBuffer());
//deno.print(`after`);
const resUi8 = new Uint8Array(res);
deno.print(`before`);
const msg = pb.Msg.decode(resUi8);
deno.print(`after`);
const {
startCwd: cwd,
startArgv: argv,
startDebugFlag: debugFlag,
startMainJs: mainJs,
startMainMap: mainMap
} = msg;
deno.print(`cwd: ${cwd}`);
deno.print(`debugFlag: ${debugFlag}`);
for (let i = 0; i < argv.length; i++) {
deno.print(`argv[${i}] ${argv[i]}`);
}
};
function typedArrayToArrayBuffer(ta: Uint8Array): ArrayBuffer {
return ta.buffer.slice(
ta.byteOffset,
ta.byteOffset + ta.byteLength
) as ArrayBuffer;
}
function emptyArrayBuffer(): ArrayBuffer {
return typedArrayToArrayBuffer(new Uint8Array([]));
}