mirror of
https://github.com/zaphar/sycamore-state.git
synced 2025-07-23 20:39:50 -04:00
Add a dispatch_and method
This commit is contained in:
parent
bc8854b4dd
commit
6490d6db4d
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sycamore-state"
|
name = "sycamore-state"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -59,6 +59,15 @@ where
|
|||||||
self.dispatcher.map(cx, msg, self.signal)
|
self.dispatcher.map(cx, msg, self.signal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Directly handle a state message and then run a Fn.
|
||||||
|
pub fn dispatch_and<F>(&'ctx self, cx: Scope<'ctx>, msg: Msg, f: F)
|
||||||
|
where
|
||||||
|
F: FnOnce(),
|
||||||
|
{
|
||||||
|
self.dispatch(cx, msg);
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
|
||||||
/// Provides a ReadSignal handle for the contained Signal implementation.
|
/// Provides a ReadSignal handle for the contained Signal implementation.
|
||||||
pub fn read_signal(&'ctx self) -> &'ctx ReadSignal<T> {
|
pub fn read_signal(&'ctx self) -> &'ctx ReadSignal<T> {
|
||||||
self.signal
|
self.signal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user