diff --git a/guide/src/reference/js-promises-and-rust-futures.md b/guide/src/reference/js-promises-and-rust-futures.md index 1598a1e83ba..89aea0a1e82 100644 --- a/guide/src/reference/js-promises-and-rust-futures.md +++ b/guide/src/reference/js-promises-and-rust-futures.md @@ -32,9 +32,13 @@ must be `JsValue` or no return at all: ```rust #[wasm_bindgen] extern "C" { - async fn async_func_1() -> JsValue; + async fn async_func_1_ret_number() -> JsValue; async fn async_func_2(); } + +async fn get_from_js() -> f64 { + async_func_1_ret_number().await.as_f64().unwrap_or(0.0) +} ``` The `async` can be combined with the `catch` attribute to manage errors from the