diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-01-21 15:53:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-21 15:53:29 +0100 |
commit | 5e2fd183ff1fe240ddbd864dbf1e6a0941fb4582 (patch) | |
tree | bf550552bd54e7adbd87749ae663b8fafb2c4f0d /cli/js/os.ts | |
parent | 0cd605515c99458fa80cd4a1a3906f3db37a86ca (diff) |
refactor: Rename JS entry functions (#3732)
Diffstat (limited to 'cli/js/os.ts')
-rw-r--r-- | cli/js/os.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cli/js/os.ts b/cli/js/os.ts index 2a3a51de7..cf522f857 100644 --- a/cli/js/os.ts +++ b/cli/js/os.ts @@ -84,13 +84,10 @@ interface Start { arch: Arch; } -// This function bootstraps an environment within Deno, it is shared both by -// the runtime and the compiler environments. -// @internal -export function start(preserveDenoNamespace = true, source?: string): Start { +// TODO(bartlomieju): temporary solution, must be fixed when moving +// dispatches to separate crates +export function initOps(): 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 @@ -98,6 +95,13 @@ export function start(preserveDenoNamespace = true, source?: string): Start { ((dispatch as unknown) as { [key: string]: number })[opName] = opId; core.setAsyncHandler(opId, dispatch.getAsyncHandler(opName)); } +} + +// This function bootstraps an environment within Deno, it is shared both by +// the runtime and the compiler environments. +// @internal +export function start(preserveDenoNamespace = true, source?: string): Start { + initOps(); // First we send an empty `Start` message to let the privileged side know we // are ready. The response should be a `StartRes` message containing the CLI // args and other info. |