From 74fe752ea0bd8b0c25a0db15bbc56b1753bb3a11 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 21:11:09 +0200 Subject: not working --- src/crypto/cryptoWorker.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/crypto/cryptoWorker.ts') 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 }); + }); }; -- cgit v1.2.3