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

Syntax changes and renames to State and Flow Handlers #81

Merged
merged 1 commit into from Feb 3, 2022

Conversation

calebjclark
Copy link
Contributor

All of these except the last are ones we discussed yesterday. I implemented them in Hero to see if it made my scripts feel simpler and they did, so I submitted a PR.

  1. The allTrue in State has been simplified down to just all with the first argument being assert and not { assert }:
hero.waitForState({
  all(assert) {
    ....
  }
});
  1. The State Methods (checkState, waitForState, and registerFlowHandler) now accept a simplified first argument of just the all(assert) callback:
hero.waitForState(assert => {
  ....
});
  1. checkFlowHandlers has been renamed to triggerFlowHandlers to be more precise in what it does.

  2. checkState has been renamed to validateState. I understand why we went with "checkState" as "ensureState" wasn't quite accurate (it doesn't actually ensure anything, it just returns a boolean). However, check never felt right in my script flow; I want it for a purpose, to validate the current state. Anyway, I'm cool reverting back to "checkState" if you want.

One thought... We've discussed wanting to pass state assertion results into Flow Handler callbacks. Similarly, returning a "validation object" from validateState of what assertions passed would be really nice and further lean towards the validateState name.

@blakebyrnes blakebyrnes merged commit fd4b7ff into main Feb 3, 2022
@blakebyrnes blakebyrnes deleted the state-syntax branch February 3, 2022 13:52
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.

None yet

2 participants