Minor code review of WASM-loading code

pull/2/head
Raymond Hill 4 years ago
parent 2936d73911
commit a9bcc70a2b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -519,12 +519,11 @@ const HNTrieContainer = class {
}
async initWASM() {
const module = await HNTrieContainer.enableWASM();
if ( module instanceof WebAssembly.Module === false ) { return false; }
if ( this.wasmInstancePromise !== null ) {
return true;
return this.wasmInstancePromise;
}
const module = await HNTrieContainer.enableWASM();
if ( module instanceof WebAssembly.Module === false ) { return false; }
const memory = new WebAssembly.Memory({ initial: 2 });
this.wasmInstancePromise = WebAssembly.instantiate(
module,

@ -32,7 +32,9 @@
]);
log.info(`User settings ready ${Date.now()-vAPI.T0} ms after launch`);
const shouldWASM = µm.rawSettings.disableWebAssembly !== true;
const shouldWASM =
vAPI.canWASM === true &&
µm.rawSettings.disableWebAssembly !== true;
if ( shouldWASM ) {
await Promise.all([
µm.HNTrieContainer.enableWASM(),

Loading…
Cancel
Save