Skip to content

Commit

Permalink
Comment about re-exporting the JS bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhose committed Nov 28, 2024
1 parent 61e433c commit 8df6ed5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function initAsync() {
}

module.exports = {
// Re-export everything from the wasm module bindings
// Re-export everything from the generated javascript wrappers
...bindings,
initAsync,
};
4 changes: 3 additions & 1 deletion index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

// This is the entrypoint on non-node ESM environments.
// `asyncLoad` will load the WASM module using a `fetch` call.
export * from "./pkg/matrix_sdk_crypto_wasm_bg.js";
import * as bindings from "./pkg/matrix_sdk_crypto_wasm_bg.js";

const moduleUrl = new URL("./pkg/matrix_sdk_crypto_wasm_bg.wasm", import.meta.url);
Expand Down Expand Up @@ -45,3 +44,6 @@ export async function initAsync() {
bindings.__wbg_set_wasm(instance.exports);
instance.exports.__wbindgen_start();
}

// Re-export everything from the generated javascript wrappers
export * from "./pkg/matrix_sdk_crypto_wasm_bg.js";
1 change: 1 addition & 0 deletions node.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function initAsync() {
}

module.exports = {
// Re-export everything from the generated javascript wrappers
...bindings,
initAsync,
};
4 changes: 3 additions & 1 deletion node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import { fileURLToPath } from "node:url";
import { readFile } from "node:fs/promises";
import * as bindings from "./pkg/matrix_sdk_crypto_wasm_bg.js";
export * from "./pkg/matrix_sdk_crypto_wasm_bg.js";

const filename = fileURLToPath(new URL("./pkg/matrix_sdk_crypto_wasm_bg.wasm", import.meta.url));

Expand All @@ -38,3 +37,6 @@ export async function initAsync() {
bindings.__wbg_set_wasm(instance.exports);
instance.exports.__wbindgen_start();
}

// Re-export everything from the generated javascript wrappers
export * from "./pkg/matrix_sdk_crypto_wasm_bg.js";

0 comments on commit 8df6ed5

Please sign in to comment.