From 59a556970e2bcad497838ee7fadbc90c4fedc345 Mon Sep 17 00:00:00 2001 From: Will Eastcott Date: Wed, 23 Apr 2025 11:40:55 +0100 Subject: [PATCH] Refactor module handling --- src/module.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/module.ts b/src/module.ts index 57ac27a..ecb84fe 100644 --- a/src/module.ts +++ b/src/module.ts @@ -17,22 +17,15 @@ class ModuleElement extends HTMLElement { private async loadModule(): Promise { const name = this.getAttribute('name')!; - const glue = this.getAttribute('glue')!; - const wasm = this.getAttribute('wasm')!; - const fallback = this.getAttribute('fallback')!; + const glueUrl = this.getAttribute('glue')!; + const wasmUrl = this.getAttribute('wasm')!; + const fallbackUrl = this.getAttribute('fallback')!; + const config = { glueUrl, wasmUrl, fallbackUrl }; if (name === 'Basis') { - basisInitialize({ - glueUrl: glue, - wasmUrl: wasm, - fallbackUrl: fallback - }); + basisInitialize(config); } else { - WasmModule.setConfig(name, { - glueUrl: glue, - wasmUrl: wasm, - fallbackUrl: fallback - }); + WasmModule.setConfig(name, config); await new Promise((resolve) => { WasmModule.getInstance(name, () => resolve());