1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// use serde::{Deserialize, Serialize};
// use std::collections::HashSet;
// use yew::worker::*;
// #[derive(Serialize, Deserialize, Debug)]
// pub enum Request {
// EventBusMsg(String),
// }
// pub struct EventBus {
// link: AgentLink<EventBus>,
// subscribers: HashSet<HandlerId>,
// }
// impl Agent for EventBus {
// type Reach = Context<Self>;
// type Message = ();
// type Input = Request;
// type Output = String;
// fn create(link: AgentLink<Self>) -> Self {
// Self {
// link,
// subscribers: HashSet::new(),
// }
// }
// fn update(&mut self, _msg: Self::Message) {}
// fn handle_input(&mut self, msg: Self::Input, _id: HandlerId) {
// match msg {
// Request::EventBusMsg(s) => {
// for sub in self.subscribers.iter() {
// self.link.respond(*sub, s.clone());
// }
// }
// }
// }
// fn connected(&mut self, id: HandlerId) {
// self.subscribers.insert(id);
// }
// fn disconnected(&mut self, id: HandlerId) {
// self.subscribers.remove(&id);
// }
// }
// pub struct Model;
// impl Component for Model {
// type Message = ();
// type Properties = ();
// fn create(_props: Self::Properties, _link: ComponentLink<Self>) -> Self {
// Self
// }
// fn change(&mut self, _msg: Self::Properties) -> ShouldRender {
// false
// }
// fn update(&mut self, _props: Self::Message) -> ShouldRender {
// unimplemented!()
// }
// fn view(&self) -> Html {
// html! {
// <>
// <Producer />
// <Subscriber />
// </>
// }
// }
// }