@pi-oxide/pi-host-web 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pi_host_web_bg.wasm +0 -0
- package/sdk/index.js +3 -3
package/package.json
CHANGED
package/pi_host_web_bg.wasm
CHANGED
|
Binary file
|
package/sdk/index.js
CHANGED
|
@@ -35,14 +35,14 @@ let initialized = false;
|
|
|
35
35
|
/** Ensure the WASM module is loaded. Safe to call multiple times. */
|
|
36
36
|
export async function ensureInit() {
|
|
37
37
|
if (initialized) return;
|
|
38
|
-
if (typeof
|
|
39
|
-
await init();
|
|
40
|
-
} else {
|
|
38
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
41
39
|
const { readFileSync } = await import("node:fs");
|
|
42
40
|
const bytes = readFileSync(
|
|
43
41
|
new URL("../pi_host_web_bg.wasm", import.meta.url)
|
|
44
42
|
);
|
|
45
43
|
initSync({ module: bytes });
|
|
44
|
+
} else {
|
|
45
|
+
await init();
|
|
46
46
|
}
|
|
47
47
|
initialized = true;
|
|
48
48
|
}
|