Skip to content

A library to visualise Robot3 state machines #178

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

Closed
jbreckmckye opened this issue Jun 7, 2022 · 1 comment · Fixed by #224
Closed

A library to visualise Robot3 state machines #178

jbreckmckye opened this issue Jun 7, 2022 · 1 comment · Fixed by #224

Comments

@jbreckmckye
Copy link

jbreckmckye commented Jun 7, 2022

I already shared this on Twitter, but I thought I would raise an 'issue' to give it more visibility.

Robot3-Viz is a library for visualising Robot 3 finite state machines. You can use it with a plain JS API or with React.

For instance, given a state machine like

export const invokePromises = createMachine({
  idle: state(
    transition('load', 'loading')
  ),
  loading: invoke(async () => Promise.resolve(true),
    transition('done', 'idle',
      reduce((ctx: any, ev: any) => ({ ...ctx, user: ev.data }))
    ),
    transition('error', 'error',
      reduce((ctx: any, ev: any) => ({ ...ctx, error: ev.error }))
    ),
    transition('abort', 'idle')
  ),
  error: state()
})

The library outputs a visualisation like this

image

The library requires a DOM to render. If you want to use it as part of an automated process, it needs to be on a machine with either a screenbuffer or XVFB.

Documentation and more examples are in the README.

@matthewp
Copy link
Owner

matthewp commented Jun 7, 2022

Whoa! Did you tag me? I must have missed it.

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 a pull request may close this issue.

2 participants