Closed wainwrightmark closed 1 year ago
Closes https://github.com/intendednull/yewdux/issues/51
This allows you to inject listeners into the #[store] macro
#[store]
#[derive(Default, Clone, PartialEq, Eq, Deserialize, Serialize, Store)] #[store(storage = "local", listener(LogListener))] struct State { count: u32, } struct LogListener; impl Listener for LogListener { type Store = State; fn on_change(&mut self, state: Rc<Self::Store>) { log!(Level::Info, "Count changed to {}", state.count); } }
This also fixes a bug where adding more than one listener would drop previous listeners.
Thank you for your contribution
Closes https://github.com/intendednull/yewdux/issues/51
This allows you to inject listeners into the
#[store]
macroThis also fixes a bug where adding more than one listener would drop previous listeners.