Skip to content

Instantly share code, notes, and snippets.

@pix0r
Last active January 8, 2021 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pix0r/f85417ecaf7c043c72aa34b0279702ea to your computer and use it in GitHub Desktop.
Save pix0r/f85417ecaf7c043c72aa34b0279702ea to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const otherMachine = Machine({
id: 'updateStatus',
initial: 'view',
context: {},
states: {
view: {
on: {
UPDATE_WITH_INPUT: 'show_form',
UPDATE_WITHOUT_INPUT: 'process_form',
},
},
show_form: {
on: {
SAVE: 'process_form',
},
},
show_form_errors: {
on: {
VIEW_ERRORS: 'show_form',
},
},
show_form_warnings: {
on: {
SAVE_ANYWAY: 'process_form',
CANCEL: 'view',
},
},
process_form: {
on: {
ERRORS: 'show_form_errors',
WARNINGS: 'show_form_warnings',
SUCCESS: 'view',
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment