Reduce wasm file fetches to one

This commit is contained in:
Maximilian Ammann 2022-04-15 22:27:40 +02:00
parent 7b44c5e96f
commit 9f019f8023
2 changed files with 15 additions and 15 deletions

View File

@ -33,9 +33,9 @@ const isWebGLSupported = () => {
}
const checkWasmFeatures = async () => {
const checkFeature = async function (feature: () => Promise<boolean>) {
const checkFeature = async function (featureName: string, feature: () => Promise<boolean>) {
let result = await feature();
let msg = `The feature ${feature.name} returned: ${result}`;
let msg = `The feature ${featureName} returned: ${result}`;
if (result) {
console.log(msg);
} else {
@ -43,17 +43,17 @@ const checkWasmFeatures = async () => {
}
}
await checkFeature(bulkMemory);
await checkFeature(exceptions);
await checkFeature(multiValue);
await checkFeature(mutableGlobals);
await checkFeature(referenceTypes);
await checkFeature(saturatedFloatToInt);
await checkFeature(signExtensions);
await checkFeature(simd);
await checkFeature(tailCall);
await checkFeature(threads);
await checkFeature(bigInt);
await checkFeature("bulkMemory", bulkMemory);
await checkFeature("exceptions", exceptions);
await checkFeature("multiValue", multiValue);
await checkFeature("mutableGlobals", mutableGlobals);
await checkFeature("referenceTypes", referenceTypes);
await checkFeature("saturatedFloatToInt", saturatedFloatToInt);
await checkFeature("signExtensions", signExtensions);
await checkFeature("simd", simd);
await checkFeature("tailCall", tailCall);
await checkFeature("threads", threads);
await checkFeature("bigInt", bigInt);
}
const alertUser = (message: string) => {
@ -158,7 +158,7 @@ const start = async () => {
});
})
setupLegacyWebWorker(schedulerPtr, memory)
// setupLegacyWebWorker(schedulerPtr, memory)
await run(schedulerPtr)
}

View File

@ -1,7 +1,7 @@
import init, {child_entry_point} from "./dist/libs/mapr"
onmessage = async message => {
const initialised = init(undefined, message.data[1]).catch(err => {
const initialised = init(message.data[0], message.data[1]).catch(err => {
// Propagate to main `onerror`:
setTimeout(() => {
throw err;