diff --git a/package.json b/package.json index 83fa2db..57e5886 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@picovoice/web-utils", - "version": "1.3.2", + "version": "1.3.3", "description": "Picovoice web utility functions", "author": "Picovoice", "license": "Apache-2.0", diff --git a/src/wasm.ts b/src/wasm.ts index 733d66f..bbc2054 100644 --- a/src/wasm.ts +++ b/src/wasm.ts @@ -35,12 +35,14 @@ export type pv_free_type = (ptr: number) => Promise; * @param memory Initialized WebAssembly memory object. * @param wasm The wasm file in base64 string or stream to public path (i.e. fetch("file.wasm")) to initialize. * @param pvError The PvError object to store error details. + * @param additionalImports Extra WASM imports. * @returns An object containing the exported functions from WASM. */ export async function buildWasm( memory: WebAssembly.Memory, wasm: string | Promise, - pvError?: PvError + pvError?: PvError, + additionalImports: Record = {}, ): Promise { const memoryBufferUint8 = new Uint8Array(memory.buffer); const memoryBufferInt32 = new Int32Array(memory.buffer); @@ -376,7 +378,8 @@ export async function buildWasm( pv_file_write_wasm: pvFileWriteWasm, pv_file_seek_wasm: pvFileSeekWasm, pv_file_tell_wasm: pvFileTellWasm, - pv_file_remove_wasm: pvFileRemoveWasm + pv_file_remove_wasm: pvFileRemoveWasm, + ...additionalImports }, };