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 e6c41be commit e65eb1b
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 e65eb1b

Please sign in to comment.