From cc4e8ddc85d36f29a7385a7f4eb08c77f46b3af6 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 31 Jul 2019 01:33:56 +0200 Subject: headless wallet WIP --- src/crypto/cryptoWorker.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/crypto/cryptoWorker.ts') diff --git a/src/crypto/cryptoWorker.ts b/src/crypto/cryptoWorker.ts index 9c5263a6f..5acda9053 100644 --- a/src/crypto/cryptoWorker.ts +++ b/src/crypto/cryptoWorker.ts @@ -56,6 +56,9 @@ import { import * as native from "./emscInterface"; namespace RpcFunctions { + + export let enableTracing: boolean = false; + /** * Create a pre-coin of the given denomination to be withdrawn from then given * reserve. @@ -735,19 +738,25 @@ worker.onmessage = (msg: MessageEvent) => { return; } - console.log("onmessage with", msg.data.operation); - console.log("foo"); + if (RpcFunctions.enableTracing) { + console.log("onmessage with", msg.data.operation); + } emscLoader.getLib().then(p => { const lib = p.lib; if (!native.isInitialized()) { - console.log("initializing emscripten for then first time with lib"); + if (RpcFunctions.enableTracing) { + console.log("initializing emscripten for then first time with lib"); + } native.initialize(lib); } - - console.log("about to execute", msg.data.operation); + if (RpcFunctions.enableTracing) { + console.log("about to execute", msg.data.operation); + } const res = f(...msg.data.args); - console.log("finished executing", msg.data.operation); + if (RpcFunctions.enableTracing) { + console.log("finished executing", msg.data.operation); + } worker.postMessage({ result: res, id: msg.data.id }); }); }; -- cgit v1.2.3