You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which will return true of the state is foo and the child machine's state is bar. This is pretty nice.
However, one thing I've wanted for a while is the ability to do unions for matching. In JavaScript you can use bitwise operators to do union matching, like so:
I'd like to explore possibly allowing for such a thing. This would likely mean creating the state bits so users don't have to. Here's a possibly api:
const{ yellow, green }=machine.states;service.matches(yellow|green);
This seems fine. What about child states though? I would want to incorporate these some how as well so you can do the sort of service.matches('foo.bar') check that's shown at the top of this issue.
The text was updated successfully, but these errors were encountered:
In this branch I implemented
matches()
which works like in XState: https://github.com/matthewp/robot/tree/matchesThat is, you can do something like this:
Which will return true of the state is
foo
and the child machine's state isbar
. This is pretty nice.However, one thing I've wanted for a while is the ability to do unions for matching. In JavaScript you can use bitwise operators to do union matching, like so:
It would be cool to incorporate this into Robot some how. What if you could pass such a union into a
service.matches()
API like so:I'd like to explore possibly allowing for such a thing. This would likely mean creating the state bits so users don't have to. Here's a possibly api:
This seems fine. What about child states though? I would want to incorporate these some how as well so you can do the sort of
service.matches('foo.bar')
check that's shown at the top of this issue.The text was updated successfully, but these errors were encountered: