Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Last active September 14, 2020 03:06
Show Gist options
  • Save tomByrer/86390c6162346d3284862d9611b18074 to your computer and use it in GitHub Desktop.
Save tomByrer/86390c6162346d3284862d9611b18074 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const superButton = Machine(
{
id: 'superButton',
initial: 'ready',
context: {
disabled: 0
},
states: {
ready: {
on: {
DISABLE: 'disabled',
CHECK: 'processing',
},
},
disabled: {
on: {
ENABLE: 'ready',
},
},
processing: {
on: {
SUCCEED: 'succeeded',
FAIL: 'failed',
},
},
succeeded: {
on: {
NEXT: 'ready',
},
},
failed: {
on: {
RESET: 'ready',
RETRY: 'processing',
},
},
},
},
{
actions: {
myAction: () => {
console.log("myAction");
},
},
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment