Skip to content

Commit

Permalink
Properly eagerly import and await
Browse files Browse the repository at this point in the history
  • Loading branch information
cerisier committed Jan 14, 2025
1 parent a517ff5 commit b7a2788
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/demangle/demangle.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import createWasmDemangleModule from './demangle.wasm'

const wasmDemangleModulePromise = createWasmDemangleModule().then((module) => module)

const cache = new Map<string, string>()

export async function loadDemangling(): Promise<(name: string) => string> {
// This function converts a mangled C++ name such as "__ZNK7Support6ColorFeqERKS0_"
// into a human-readable symbol (in this case "Support::ColorF::==(Support::ColorF&)")
const wasmDemangleModule = await createWasmDemangleModule()
const wasmDemangleModule = await wasmDemangleModulePromise
return cached(wasmDemangleModule.wasm_demangle)
}

Expand Down

0 comments on commit b7a2788

Please sign in to comment.