mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-05-05 21:03:17 +12:00
Minor code review of WASM-loading code
This commit is contained in:
parent
2936d73911
commit
a9bcc70a2b
|
@ -519,12 +519,11 @@ const HNTrieContainer = class {
|
|||
}
|
||||
|
||||
async initWASM() {
|
||||
if ( this.wasmInstancePromise !== null ) {
|
||||
return this.wasmInstancePromise;
|
||||
}
|
||||
const module = await HNTrieContainer.enableWASM();
|
||||
if ( module instanceof WebAssembly.Module === false ) { return false; }
|
||||
|
||||
if ( this.wasmInstancePromise !== null ) {
|
||||
return true;
|
||||
}
|
||||
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…
Reference in a new issue