Skip to content

Commit 465f154

Browse files
committed
update buildWasm function
1 parent 65f30ce commit 465f154

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@picovoice/web-utils",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"description": "Picovoice web utility functions",
55
"author": "Picovoice",
66
"license": "Apache-2.0",

src/wasm.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ export type pv_free_type = (ptr: number) => Promise<void>;
3535
* @param memory Initialized WebAssembly memory object.
3636
* @param wasm The wasm file in base64 string or stream to public path (i.e. fetch("file.wasm")) to initialize.
3737
* @param pvError The PvError object to store error details.
38+
* @param additionalImports Extra WASM imports.
3839
* @returns An object containing the exported functions from WASM.
3940
*/
4041
export async function buildWasm(
4142
memory: WebAssembly.Memory,
4243
wasm: string | Promise<Response>,
43-
pvError?: PvError
44+
pvError?: PvError,
45+
additionalImports: Record<string, any> = {},
4446
): Promise<any> {
4547
const memoryBufferUint8 = new Uint8Array(memory.buffer);
4648
const memoryBufferInt32 = new Int32Array(memory.buffer);
@@ -376,7 +378,8 @@ export async function buildWasm(
376378
pv_file_write_wasm: pvFileWriteWasm,
377379
pv_file_seek_wasm: pvFileSeekWasm,
378380
pv_file_tell_wasm: pvFileTellWasm,
379-
pv_file_remove_wasm: pvFileRemoveWasm
381+
pv_file_remove_wasm: pvFileRemoveWasm,
382+
...additionalImports
380383
},
381384
};
382385

0 commit comments

Comments
 (0)