Skip to content

Commit

Permalink
Work around asnyc wasm code
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGross committed Nov 23, 2023
1 parent 02385e0 commit 204b881
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions fiat-html/wasm_fiat_crypto_worker.js
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 204b881

Please sign in to comment.