throttle history updates to 100ms

This commit is contained in:
Evan Almloff committed 2023-06-19 12:04:06 -05:00
1 parent fe626c67bd
commit bc063c58b7
3 files changed
+116 -4

No files matched your search

+22
View File
@@ -30,6 +30,28 @@ pub struct RouterConfig<R: Routable> {
pub(crate) on_update: Option<RoutingCallback<R>>,
}
#[cfg(feature = "serde")]
impl<R: Routable + Clone> Default for RouterConfig<R>
where
<R as std::str::FromStr>::Err: std::fmt::Display,
R: serde::Serialize + serde::de::DeserializeOwned,
{
fn default() -> Self {
Self {
failure_external_navigation: FailureExternalNavigation::<R>,
history: {
#[cfg(all(target_arch = "wasm32", feature = "web"))]
let history = Box::<WebHistory<R>>::default();
#[cfg(not(all(target_arch = "wasm32", feature = "web")))]
let history = Box::<MemoryHistory<R>>::default();
history
},
on_update: None,
}
}
}
#[cfg(not(feature = "serde"))]
impl<R: Routable + Clone> Default for RouterConfig<R>
where
<R as std::str::FromStr>::Err: std::fmt::Display,