improv(toaster): don't immediatly close without tokio
This commit is contained in:
parent
ba7001ee59
commit
958090436c
1 changed files with 12 additions and 6 deletions
|
|
@ -176,13 +176,19 @@ impl<Message: Clone + Send + 'static> Toasts<Message> {
|
||||||
|
|
||||||
let id = self.toasts.len();
|
let id = self.toasts.len();
|
||||||
self.toasts.push_back(toast);
|
self.toasts.push_back(toast);
|
||||||
let on_close = self.on_close;
|
|
||||||
|
|
||||||
crate::command::future(async move {
|
#[cfg(feature = "tokio")]
|
||||||
#[cfg(feature = "tokio")]
|
{
|
||||||
tokio::time::sleep(duration).await;
|
let on_close = self.on_close;
|
||||||
on_close(id)
|
crate::command::future(async move {
|
||||||
})
|
tokio::time::sleep(duration).await;
|
||||||
|
on_close(id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "tokio"))]
|
||||||
|
{
|
||||||
|
Command::none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove a [`Toast`]
|
/// Remove a [`Toast`]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue