-
Hi everybody, I am reading the Is it possible to get an In the example from page 1.8 works when calling a function like this: #[wasm_bindgen]
pub fn mult(a: i32, b: i32) -> i32 {
a * b * 3
} but not with something like this: #[wasm_bindgen]
pub fn hello() -> String {
"--------- >> Hello !!".into()
} When calling a function that returns a ...
let hello = Reflect::get(c.as_ref(), &"hello1".into())?
.dyn_into::<Function>()
.expect("add export wasn't a function");
let hello_r = hello.call0(&JsValue::undefined())?;
console_log!("# From call0: {:?}", hello_r);
... Is there any way to get the string? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After days of learning and exploring. I can now answer this question. Short answer is "yes you can" but you would have to manage the "translation" of the function since wasm does not returns strings. If someone out there needs to know more about the issue you can check this code where I show how, and this Stack Overflow post |
Beta Was this translation helpful? Give feedback.
After days of learning and exploring. I can now answer this question. Short answer is "yes you can" but you would have to manage the "translation" of the function since wasm does not returns strings. If someone out there needs to know more about the issue you can check this code where I show how, and this Stack Overflow post