diff --git a/fiat-html/wasm_fiat_crypto_worker.js b/fiat-html/wasm_fiat_crypto_worker.js index f596fc6aa6..1e0f747f2a 100644 --- a/fiat-html/wasm_fiat_crypto_worker.js +++ b/fiat-html/wasm_fiat_crypto_worker.js @@ -1,9 +1,15 @@ self.importScripts("wasm_fiat_crypto.js"); -self.onmessage = function(e) { - try { - const result = synthesize(e.data); - postMessage({result: result}); - } catch (err) { - postMessage({error: err}); - } -}; +let pending = []; +self.onmessage = function (e) { pending.push(e); }; +setTimeout(function () { + self.onmessage = function(e) { + try { + const result = synthesize(e.data); + postMessage({result: result}); + } catch (err) { + postMessage({error: err}); + } + }; + pending.forEach(e => { self.onmessage(e); }); + pending = []; +}, 1000);