Skip to content

Instantly share code, notes, and snippets.

@epan
Created June 13, 2020 05:09
Show Gist options
  • Save epan/86512bbd85b59edd64e429cc69b2340e to your computer and use it in GitHub Desktop.
Save epan/86512bbd85b59edd64e429cc69b2340e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// V3
// Transitions, assuming no cancel, no fails, no loading (V3)
const simplifiedExistingMachine = Machine({
id: 'simplifiedExisting',
initial: 'closed',
context: {},
states: {
closed: {
on: {
OPEN: 'addressList'
}
},
addressList: {
on: {
SELECT_EXISTING: 'closed',
EDIT_EXISTING: 'addressEditExisting',
SELECT_NEW: 'addressEditNew'
}
},
addressEditNew: {
on: {
SAVE: 'closed',
ADJUST_PIN: 'changePinLocationNew'
}
},
addressEditExisting: {
on: {
SAVE: 'addressList',
ADJUST_PIN: 'changePinLocationNew'
}
},
changePinLocationNew: {
on: {
SAVE: 'addressEditNew'
}
},
changePinLocationExisting: {
on: {
SAVE: 'addressEditExisting'
}
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment