summaryrefslogtreecommitdiff
path: root/cli/js/worker_main.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-01-21 15:53:29 +0100
committerGitHub <noreply@github.com>2020-01-21 15:53:29 +0100
commit5e2fd183ff1fe240ddbd864dbf1e6a0941fb4582 (patch)
treebf550552bd54e7adbd87749ae663b8fafb2c4f0d /cli/js/worker_main.ts
parent0cd605515c99458fa80cd4a1a3906f3db37a86ca (diff)
refactor: Rename JS entry functions (#3732)
Diffstat (limited to 'cli/js/worker_main.ts')
-rw-r--r--cli/js/worker_main.ts19
1 files changed, 5 insertions, 14 deletions
diff --git a/cli/js/worker_main.ts b/cli/js/worker_main.ts
index cb70057ea..16d1ef24e 100644
--- a/cli/js/worker_main.ts
+++ b/cli/js/worker_main.ts
@@ -1,10 +1,10 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { core } from "./core.ts";
import * as dispatch from "./dispatch.ts";
import { sendAsync, sendSync } from "./dispatch_json.ts";
import { log } from "./util.ts";
import { TextDecoder, TextEncoder } from "./text_encoding.ts";
+import { initOps } from "./os.ts";
const encoder = new TextEncoder();
const decoder = new TextDecoder();
@@ -44,24 +44,15 @@ export function workerClose(): void {
isClosing = true;
}
-export async function workerMain(): Promise<void> {
- const ops = core.ops();
- // TODO(bartlomieju): this is a prototype, we should come up with
- // something a bit more sophisticated
- for (const [name, opId] of Object.entries(ops)) {
- const opName = `OP_${name.toUpperCase()}`;
- // Assign op ids to actual variables
- // TODO(ry) This type casting is gross and should be fixed.
- ((dispatch as unknown) as { [key: string]: number })[opName] = opId;
- core.setAsyncHandler(opId, dispatch.getAsyncHandler(opName));
- }
+export async function bootstrapWorkerRuntime(): Promise<void> {
+ initOps();
- log("workerMain");
+ log("bootstrapWorkerRuntime");
while (!isClosing) {
const data = await getMessage();
if (data == null) {
- log("workerMain got null message. quitting.");
+ log("bootstrapWorkerRuntime got null message. quitting.");
break;
}