Minor code review of WASM-loading code

pull/2/head
Raymond Hill 5 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() { async initWASM() {
const module = await HNTrieContainer.enableWASM();
if ( module instanceof WebAssembly.Module === false ) { return false; }
if ( this.wasmInstancePromise !== null ) { 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 }); const memory = new WebAssembly.Memory({ initial: 2 });
this.wasmInstancePromise = WebAssembly.instantiate( this.wasmInstancePromise = WebAssembly.instantiate(
module, module,

@ -32,7 +32,9 @@
]); ]);
log.info(`User settings ready ${Date.now()-vAPI.T0} ms after launch`); 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 ) { if ( shouldWASM ) {
await Promise.all([ await Promise.all([
µm.HNTrieContainer.enableWASM(), µm.HNTrieContainer.enableWASM(),

Loading…
Cancel
Save