Ensure browser supports workers-in-workers (#1325)

Fixes #1324
This commit is contained in:
Jake Archibald
2023-01-09 10:42:14 +00:00
committed by GitHub
parent 13a185def2
commit 583117697e
12 changed files with 39 additions and 16 deletions

View File

@@ -14,12 +14,13 @@ import type { WP2Module } from 'codecs/wp2/enc/wp2_enc';
import type { EncodeOptions } from '../shared/meta';
import { initEmscriptenModule } from 'features/worker-utils';
import { threads, simd } from 'wasm-feature-detect';
import { simd } from 'wasm-feature-detect';
import checkThreadsSupport from 'worker-shared/supports-wasm-threads';
let emscriptenModule: Promise<WP2Module>;
async function init() {
if (await threads()) {
if (await checkThreadsSupport()) {
if (await simd()) {
const wp2Encoder = await import('codecs/wp2/enc/wp2_enc_mt_simd');
return initEmscriptenModule(wp2Encoder.default);