mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-22 12:42:14 +00:00
Fix the console_log
example
This commit is contained in:
parent
dd3dba9285
commit
e283093997
@ -8,4 +8,3 @@ crate-type = ["cdylib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = { path = "../.." }
|
wasm-bindgen = { path = "../.." }
|
||||||
web-sys = { path = "../../crates/web-sys" }
|
|
@ -1,11 +1,7 @@
|
|||||||
extern crate wasm_bindgen;
|
extern crate wasm_bindgen;
|
||||||
extern crate web_sys;
|
|
||||||
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
// You can use the console bindings from web-sys...
|
|
||||||
use web_sys::console;
|
|
||||||
|
|
||||||
// ... or you can manually write the bindings yourself
|
// ... or you can manually write the bindings yourself
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -22,7 +18,4 @@ pub fn run() {
|
|||||||
log("Hello from Rust!");
|
log("Hello from Rust!");
|
||||||
log_u32(42);
|
log_u32(42);
|
||||||
log_many("Logging", "many values!");
|
log_many("Logging", "many values!");
|
||||||
|
|
||||||
console::log(JsValue::from("Another message from rust!"));
|
|
||||||
console::log(JsValue::from(56u32));
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user