Skip to content

Can I read from channels and Update the model? #599

Answered by deicon
rew1nter asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure what the exact problem is here. The sample does exactly what you where asking for. I didn't know this one but the more complex one in glow. But still they both do the same thing.

In Init(), we send out two commands. One for each side of the channel.

listenForActivity(m.sub), // generate activity
waitForActivity(m.sub),   // wait for activity

Those two methods return a cmd each. Each command basically is an action, which once it finishes delivers a message. Message can transport data.
Once a Message is received, it is passed into the Update Method of the model, where the Model can react on the message and literally update its state aka model.

So in this example, the listenForActi…

Replies: 9 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@meowgorithm
Comment options

Answer selected by meowgorithm
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@deicon
Comment options

@franalbani
Comment options

@meowgorithm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #596 on November 14, 2022 12:06.