Remove race condition between assemble and prelude load prints
This commit was merged in pull request #1.
This commit is contained in:
19
boot.js
19
boot.js
@@ -10,10 +10,17 @@ const assemble = (async () => {
|
||||
})();
|
||||
|
||||
self.onmessage = async (e) => {
|
||||
const exports = { emu: { mem: e.data } };
|
||||
const wasm = await assemble;
|
||||
const mod = await WebAssembly.instantiate(wasm, exports);
|
||||
await self.postMessage('booting');
|
||||
mod.instance.exports.reset();
|
||||
console.log('System halt');
|
||||
switch (e.data.type) {
|
||||
case "load":
|
||||
const exports = { emu: { mem: e.data.mem } };
|
||||
const wasm = await assemble;
|
||||
self.mod = await WebAssembly.instantiate(wasm, exports);
|
||||
await self.postMessage('ready');
|
||||
break;
|
||||
|
||||
case "boot":
|
||||
self.mod.instance.exports.reset();
|
||||
console.log('System halt');
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user