Introduce window::Id to Event subscriptions
And remove `window::Id` from `Event` altogether.
This commit is contained in:
parent
49affc44ff
commit
e400f972c1
19 changed files with 95 additions and 91 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::core::event::{self, Event};
|
||||
use crate::core::window;
|
||||
use crate::subscription::{Hasher, Recipe};
|
||||
use crate::{BoxFuture, MaybeSend};
|
||||
|
||||
|
|
@ -23,7 +24,9 @@ pub struct Tracker {
|
|||
#[derive(Debug)]
|
||||
pub struct Execution {
|
||||
_cancel: futures::channel::oneshot::Sender<()>,
|
||||
listener: Option<futures::channel::mpsc::Sender<(Event, event::Status)>>,
|
||||
listener: Option<
|
||||
futures::channel::mpsc::Sender<(Event, event::Status, window::Id)>,
|
||||
>,
|
||||
}
|
||||
|
||||
impl Tracker {
|
||||
|
|
@ -139,12 +142,19 @@ impl Tracker {
|
|||
/// currently open.
|
||||
///
|
||||
/// [`Recipe::stream`]: crate::subscription::Recipe::stream
|
||||
pub fn broadcast(&mut self, event: Event, status: event::Status) {
|
||||
pub fn broadcast(
|
||||
&mut self,
|
||||
event: Event,
|
||||
status: event::Status,
|
||||
window: window::Id,
|
||||
) {
|
||||
self.subscriptions
|
||||
.values_mut()
|
||||
.filter_map(|connection| connection.listener.as_mut())
|
||||
.for_each(|listener| {
|
||||
if let Err(error) = listener.try_send((event.clone(), status)) {
|
||||
if let Err(error) =
|
||||
listener.try_send((event.clone(), status, window))
|
||||
{
|
||||
log::warn!(
|
||||
"Error sending event to subscription: {error:?}"
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue