mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 08:17:40 +03:00
repl_wasm: add a console_log macro for browser debugging
This commit is contained in:
parent
e98dc68462
commit
640e941498
@ -13,6 +13,16 @@ extern "C" {
|
||||
pub fn js_run_app() -> usize;
|
||||
|
||||
pub fn js_get_result_and_memory(buffer_alloc_addr: *mut u8) -> usize;
|
||||
|
||||
#[wasm_bindgen(js_namespace = console)]
|
||||
fn log(s: &str);
|
||||
}
|
||||
|
||||
// To debug wasm issues, start up the web REPL as per instructions in repl_www/README.md
|
||||
// Then sprinkle your code with console_log!("{:?}", my_value);
|
||||
#[macro_export]
|
||||
macro_rules! console_log {
|
||||
($($t:tt)*) => (log(&format_args!($($t)*).to_string()))
|
||||
}
|
||||
|
||||
/// Async entrypoint for the browser
|
||||
|
Loading…
Reference in New Issue
Block a user