File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -35,26 +35,32 @@ function isSameConfig(a, b) {
3535 return a . rendering === b . rendering && a . exec === b . exec ;
3636}
3737
38+ /**
39+ * Generate a WebAssembly configuration object from a wasmLoader config.
40+ * @param {* } config - wasmLoader config with 'rendering' and 'exec' keys.
41+ * @returns wasmConfig object
42+ */
3843export function generateWasmConfig ( config ) {
44+ let wasmConfig = { }
3945 if ( WASM_FILE_OBJECT ) {
40- config . locateFile = ( fileName ) => {
46+ wasmConfig . locateFile = ( fileName ) => {
4147 if ( WASM_FILE_OBJECT && fileName == WASM_FILE_OBJECT . name ) {
4248 return URL . createObjectURL ( WASM_FILE_OBJECT ) ;
4349 }
4450 return new URL ( fileName , import . meta. url ) . href ;
4551 } ;
46- config . onRuntimeInitialized = ( ) => {
52+ wasmConfig . onRuntimeInitialized = ( ) => {
4753 // Free the object URL after runtime is initialized
4854 URL . revokeObjectURL ( WASM_FILE_OBJECT ) ;
4955 WASM_FILE_OBJECT = null ;
5056 } ;
5157 }
5258 if ( config ?. rendering === "webgpu" ) {
53- config . preRun = [ ( module ) => {
59+ wasmConfig . preRun = [ ( module ) => {
5460 module . ENV . VTK_GRAPHICS_BACKEND = "WEBGPU" ;
5561 } ] ;
5662 }
57- return config ;
63+ return wasmConfig ;
5864}
5965
6066/**
You can’t perform that action at this time.
0 commit comments