diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 21:11:09 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 21:11:09 +0200 |
commit | 74fe752ea0bd8b0c25a0db15bbc56b1753bb3a11 (patch) | |
tree | f4090ae17cf8c7695cad9da9d3742818c4bfe61e /src/crypto/cryptoWorker.ts | |
parent | 1751ecb163d28da20863d463e4f21322ad1cb9ff (diff) |
not working
Diffstat (limited to 'src/crypto/cryptoWorker.ts')
-rw-r--r-- | src/crypto/cryptoWorker.ts | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/crypto/cryptoWorker.ts b/src/crypto/cryptoWorker.ts index 7cec5f284..3e71794b4 100644 --- a/src/crypto/cryptoWorker.ts +++ b/src/crypto/cryptoWorker.ts @@ -53,6 +53,8 @@ import { import { canonicalJson } from "../helpers"; +import * as emscLoader from "./emscLoader"; + import { Amount, EddsaPublicKey, @@ -580,6 +582,20 @@ worker.onmessage = (msg: MessageEvent) => { console.error(`unknown operation: '${msg.data.operation}'`); return; } - const res = f(...msg.data.args); - worker.postMessage({result: res, id: msg.data.id}); + + console.log("onmessage with", msg.data.operation); + console.log("foo"); + + emscLoader.getLib().then((p) => { + const lib = p.lib; + if (!native.isInitialized()) { + console.log("initializing emscripten for then first time with lib"); + native.initialize(lib); + } + + console.log("about to execute", msg.data.operation); + const res = f(...msg.data.args); + console.log("finished executing", msg.data.operation); + worker.postMessage({ result: res, id: msg.data.id }); + }); }; |