Skip to content

Commit a311ca5

Browse files
committed
fix: handle Result return type from watch_position in use_geolocation
The watch_position_with_error_callback_and_options method now returns Result<i32, JsValue> instead of i32 in wasm-bindgen 0.2.113. Use .ok() to convert it to Option<i32>.
1 parent d8ac876 commit a311ca5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/use_geolocation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ pub fn use_geolocation_with_options(
103103
Closure::wrap(Box::new(on_error) as Box<dyn Fn(web_sys::PositionError)>);
104104

105105
*watch_handle.lock().unwrap() =
106-
Some(geolocation.watch_position_with_error_callback_and_options(
106+
geolocation.watch_position_with_error_callback_and_options(
107107
update_position.as_ref().unchecked_ref(),
108108
Some(on_error.as_ref().unchecked_ref()),
109109
&position_options,
110-
));
110+
).ok();
111111

112112
update_position.forget();
113113
on_error.forget();

0 commit comments

Comments
 (0)