mirror of
https://github.com/bytedream/litbwraw.git
synced 2026-11-04 15:12:09 +01:00
update example nodejs scripts
This commit is contained in:
1 parent
28001a2040
commit
10eb71bb11
2 files changed
+26
-2
No files matched your search
@@ -1,5 +1,17 @@
|
||||
async function main() {
|
||||
const wasm = await import('./target/wasm32-unknown-emscripten/debug/example-binary.js');
|
||||
let wasm;
|
||||
for (const buildType of ['release', 'debug']) {
|
||||
try {
|
||||
wasm = await import(`./target/wasm32-unknown-emscripten/${buildType}/example-binary.js`);
|
||||
break;
|
||||
} catch (e) {
|
||||
if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e;
|
||||
}
|
||||
}
|
||||
if (!wasm) {
|
||||
throw new Error('Rust wasm binary not built');
|
||||
}
|
||||
|
||||
const module = {
|
||||
print: (str) => console.log(str),
|
||||
printErr: (str) => console.error(str),
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
async function main() {
|
||||
const wasm = await import('./target/wasm32-unknown-emscripten/debug/example-library.js');
|
||||
let wasm;
|
||||
for (const buildType of ['release', 'debug']) {
|
||||
try {
|
||||
wasm = await import(`./target/wasm32-unknown-emscripten/${buildType}/example-library.js`);
|
||||
break;
|
||||
} catch (e) {
|
||||
if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e;
|
||||
}
|
||||
}
|
||||
if (!wasm) {
|
||||
throw new Error('Rust wasm binary not built');
|
||||
}
|
||||
|
||||
const module = {
|
||||
print: (str) => console.log(str),
|
||||
printErr: (str) => console.error(str),
|
||||
|
||||
Reference in new issue
Block a user