diff --git a/crates/timers/src/callback.rs b/crates/timers/src/callback.rs index eaa7d5ce..6561f8af 100644 --- a/crates/timers/src/callback.rs +++ b/crates/timers/src/callback.rs @@ -12,11 +12,11 @@ extern "C" { #[wasm_bindgen(js_name = "setInterval", catch)] fn set_interval(handler: &Function, timeout: i32) -> Result; - #[wasm_bindgen(js_name = "clearTimeout")] - fn clear_timeout(handle: i32); + #[wasm_bindgen(js_name = "clearTimeout", catch)] + fn clear_timeout(handle: i32) -> Result<(), JsValue>; - #[wasm_bindgen(js_name = "clearInterval")] - fn clear_interval(handle: i32); + #[wasm_bindgen(js_name = "clearInterval", catch)] + fn clear_interval(handle: i32) -> Result<(), JsValue>; } /// A scheduled timeout. @@ -35,7 +35,7 @@ pub struct Timeout { impl Drop for Timeout { fn drop(&mut self) { if let Some(id) = self.id { - clear_timeout(id); + clear_timeout(id).unwrap_throw(); } } } @@ -135,7 +135,7 @@ pub struct Interval { impl Drop for Interval { fn drop(&mut self) { if let Some(id) = self.id { - clear_interval(id); + clear_interval(id).unwrap_throw(); } } }