Skip to content

Commit

Permalink
Fix wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaq committed Oct 12, 2024
1 parent 8220ad6 commit 8b57b35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ pub use machine::config::*;
pub use machine::lib_machine::*;
pub use machine::Machine;

/// Eval a source file in Wasm.
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
pub fn eval_code(s: &str) -> String {
use machine::mock_wam::*;

console_error_panic_hook::set_once();

let mut wam = Machine::with_test_streams();
let mut wam = MachineBuilder::default().build();
let bytes = wam.test_load_string(s);
String::from_utf8_lossy(&bytes).to_string()
}
Expand Down

0 comments on commit 8b57b35

Please sign in to comment.