Implement Task for ResizeTask
//! This module contains Yew's implementation of a service which listens for browser window resize events.
+use crate::services::Task;
use cfg_if::cfg_if;
use cfg_match::cfg_match;
use std::fmt;
@@ -81,9 +82,16 @@ impl ResizeService {
}
}
-#[cfg(feature = "std_web")]
+impl Task for ResizeTask {
+ fn is_active(&self) -> bool {
+ true
+ }
+}
+
impl Drop for ResizeTask {
fn drop(&mut self) {
+ #[cfg(feature = "std_web")]
+ {
let handle = &self.0;
js! {
@(no_return)
@@ -92,3 +100,4 @@ impl Drop for ResizeTask {
}
}
}
+}
