Skip to content
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

Let Commands wait for state to execute or expire #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

timshadel
Copy link
Member

The intent is to make it easy to issue several back-to-back commands that implicitly depend on each other before they can run. GetLocation and GetWeather are an example. You need to know the location before you can request the weather. By issuing them both at the same time, your location command can see that the existing location is recent enough, and choose to do nothing in it's execute(state:, core:) function, and the weather command will still run properly since it will find location in the proper place in state.

  • Existing commands will be unaffected. Defaults always assume commands will run.
  • Any command that implements canExecute(state:) will default to expiring in 10 seconds.
  • Commands may never run if you stop sending events to core, but if that happens your app is lifeless, so in practice this shouldn't be a problem...I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant