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

matches API #113

Closed
matthewp opened this issue Apr 25, 2020 · 1 comment
Closed

matches API #113

matthewp opened this issue Apr 25, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@matthewp
Copy link
Owner

matthewp commented Apr 25, 2020

This is something I've been experimenting with in a personal project. It would work something like this:

import {
  createMachine,
  invoke,
  state,
  state as final,
  transition
} from 'robot3';

machine = createMachine({
  idle: state(
    transition('next', 'upload')
  ),
  upload: invoke(createMachine({
    one: state(transition('next', 'done'))
    done: final()
  }), transition('done', 'idle')
})

service.matches('idle'); // true

service.send('next');

service.matches('idle'); // false
service.matches('upload.one'); // true
@matthewp matthewp added the enhancement New feature or request label Apr 25, 2020
@matthewp matthewp added this to the Road to 1.0 milestone Apr 25, 2020
@matthewp
Copy link
Owner Author

Oops! I forgot about #56

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

No branches or pull requests

1 participant