Skip to content

Commit

Permalink
update buildWasm function
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Jan 10, 2024
1 parent 65f30ce commit 465f154
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ export type pv_free_type = (ptr: number) => Promise<void>;
* @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<Response>,
pvError?: PvError
pvError?: PvError,
additionalImports: Record<string, any> = {},
): Promise<any> {
const memoryBufferUint8 = new Uint8Array(memory.buffer);
const memoryBufferInt32 = new Int32Array(memory.buffer);
Expand Down Expand Up @@ -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
},
};

Expand Down

0 comments on commit 465f154

Please sign in to comment.