mirror of
https://github.com/bytedream/litbwraw.git
synced 2025-05-09 12:15:13 +02:00
update example nodejs scripts
This commit is contained in:
parent
28001a2040
commit
10eb71bb11
@ -1,5 +1,17 @@
|
|||||||
async function main() {
|
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 = {
|
const module = {
|
||||||
print: (str) => console.log(str),
|
print: (str) => console.log(str),
|
||||||
printErr: (str) => console.error(str),
|
printErr: (str) => console.error(str),
|
||||||
|
@ -1,5 +1,17 @@
|
|||||||
async function main() {
|
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 = {
|
const module = {
|
||||||
print: (str) => console.log(str),
|
print: (str) => console.log(str),
|
||||||
printErr: (str) => console.error(str),
|
printErr: (str) => console.error(str),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user