mirror of
https://github.com/zaphar/sycamore-state.git
synced 2025-07-22 20:29:50 -04:00
Add some docs and a makefile
This commit is contained in:
parent
f74a051bf8
commit
d91823a1da
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Copyright 2022 Jeremy Wall (Jeremy@marzhilsltudios.com)
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
build:
|
||||||
|
cargo build
|
||||||
|
|
||||||
|
test: test-firefox
|
||||||
|
|
||||||
|
test-%:
|
||||||
|
wasm-pack test --$* --headless . --features async
|
@ -65,7 +65,9 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Binds a triggering signal and associated message mapping function as
|
/// Binds a triggering signal and associated message mapping function as
|
||||||
/// a state update for this Handler instance.
|
/// a state update for this Handler instance. This uses [`create_effect`]
|
||||||
|
/// so be aware that it will fire at least once when you first call it. It
|
||||||
|
/// is really easy to introduce an infinite signal update loop.
|
||||||
pub fn bind_trigger<F, Val>(
|
pub fn bind_trigger<F, Val>(
|
||||||
&'ctx self,
|
&'ctx self,
|
||||||
cx: Scope<'ctx>,
|
cx: Scope<'ctx>,
|
||||||
|
@ -27,19 +27,6 @@ pub struct FakeState {
|
|||||||
value_two: i32,
|
value_two: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum MultiMsg {
|
|
||||||
Foo(Msg),
|
|
||||||
Bar(Msg),
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct MultiState<'ctx, D>
|
|
||||||
where
|
|
||||||
D: MessageMapper<Msg, FakeState>,
|
|
||||||
{
|
|
||||||
foo: &'ctx Handler<'ctx, D, FakeState, Msg>,
|
|
||||||
bar: &'ctx Handler<'ctx, D, FakeState, Msg>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct StateMachine();
|
pub struct StateMachine();
|
||||||
|
|
||||||
impl MessageMapper<Msg, FakeState> for StateMachine {
|
impl MessageMapper<Msg, FakeState> for StateMachine {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user