Skip to content

Instantly share code, notes, and snippets.

@dynamike2010
Last active May 5, 2021 13:52
Show Gist options
  • Select an option

  • Save dynamike2010/bbc88e43f19f387055b4d51173bf11e8 to your computer and use it in GitHub Desktop.

Select an option

Save dynamike2010/bbc88e43f19f387055b4d51173bf11e8 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const modelFlow = Machine({
id: 'model',
initial: 'inactive',
states: {
'inactive': {
on: {
'check out': 'inactive - checked out',
'publish': 'active',
}
},
'inactive - checked out': {
on: {
'check in': 'inactive',
'check in & publish': 'active',
'import': 'inactive - checked out',
'save': 'inactive - checked out',
'cancel': 'inactive - checked out',
}
},
'active': {
on: {
'check out': 'active - checked out',
'archive': 'archived',
'export': 'active',
}
},
'active - checked out': {
on: {
'check in': 'active',
'archive': 'archived',
'save': 'active - checked out',
'cancel': 'active - checked out',
}
},
'archived': {
on: {
'unarchive': 'inactive'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment