mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-22 12:42:14 +00:00
Use custom setter string in dom
example
That way we can stick with idiomatic Rust!
This commit is contained in:
parent
30936a6b22
commit
a8045fbbe9
@ -24,8 +24,8 @@ extern {
|
|||||||
fn body(this: &HTMLDocument) -> Element;
|
fn body(this: &HTMLDocument) -> Element;
|
||||||
|
|
||||||
type Element;
|
type Element;
|
||||||
#[wasm_bindgen(method, setter)]
|
#[wasm_bindgen(method, setter = "innerHTML")]
|
||||||
fn set_innerHTML(this: &Element, html: &str);
|
fn set_inner_html(this: &Element, html: &str);
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
fn appendChild(this: &Element, other: Element);
|
fn appendChild(this: &Element, other: Element);
|
||||||
}
|
}
|
||||||
@ -34,6 +34,6 @@ extern {
|
|||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
let val = document.createElement("p");
|
let val = document.createElement("p");
|
||||||
val.set_innerHTML("Hello from Rust!");
|
val.set_inner_html("Hello from Rust!");
|
||||||
document.body().appendChild(val);
|
document.body().appendChild(val);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user