Use WebAssembly object directly in index.js (#3843)

This commit is contained in:
Manish Jethani 2021-08-22 01:32:32 +05:30 committed by GitHub
parent cd2a03fb89
commit d6339ada62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -19,6 +19,8 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
/* globals WebAssembly */
'use strict'; 'use strict';
/******************************************************************************/ /******************************************************************************/
@ -57,7 +59,7 @@ async function enableWASM() {
const wasmModuleFetcher = function(path) { const wasmModuleFetcher = function(path) {
const require = createRequire(import.meta.url); // jshint ignore:line const require = createRequire(import.meta.url); // jshint ignore:line
const wasm = new Uint8Array(require(`${path}.wasm.json`)); const wasm = new Uint8Array(require(`${path}.wasm.json`));
return globals.WebAssembly.compile(wasm); return WebAssembly.compile(wasm);
}; };
try { try {
const results = await Promise.all([ const results = await Promise.all([