-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dispatching events from moves #142
Comments
I'd like to point out that currently, This is just a thought, though. It looks like Just to name one alternative, we could disallow to plug other flow implementations and offer more than one standard one, should that ever prove necessary. |
For the initial API, I'd suggest the followng methods:
Should we also include I'm unsure I understood your last sentence. Could you give an example where direct modification of |
Sounds good.
|
About the special treatment of |
I realized that we don't need |
There does not exist a direct way to dispatch an event like
endTurn
orendPhase
from within a move currently. The way to do it at the moment is to useendTurnIf
orendPhaseIf
. This can lead to some annoying patterns like setting booleans whose only purpose is to trigger some code elsewhere:Rather than that, it would be nice to directly invoke events like this:
This is analogous to how the Random code works currently. It accumulates some state that has to be applied to
ctx
, and it applies it at the end of the move (in this case, the turn does not end immediately, but right after the move instead). Note that the game reducer still stays pure.This will also open up other opportunities to modify
ctx
frommoves
through a well-defined API (so that it's still framework managed and not directly editable).EDIT: Updated after #146
The text was updated successfully, but these errors were encountered: