Skip to content

Instantly share code, notes, and snippets.

@ifyoumakeit
Last active February 17, 2020 00:54
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 ifyoumakeit/667d57804dd9ceeb4c0436518f57df33 to your computer and use it in GitHub Desktop.
Save ifyoumakeit/667d57804dd9ceeb4c0436518f57df33 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 fetchMachine = Machine({
id: 'gallery',
initial: 'galleries',
context: {
retries: 0
},
states: {
galleries: {
entry: ["fetchGalleries"],
on: {
SELECT_GALLERY: 'gallery'
}
},
gallery: {
entry: ["fetchGallery"],
on: {
EDIT: 'colors',
SAVE: 'saving',
SEARCH: 'search',
EXIT: 'leave'
}
},
search: {
entry: ["fetchFrames"],
exit: ["saveColors"],
on: {
ADD_FRAMES: 'gallery',
}
},
saving: {
entry: ["saveGallery"],
on: {
FAILURE: 'gallery',
SUCCESS: 'gallery',
}
},
colors: {
entry: ["fetchColors"],
exit: ["saveColors"],
on: {
EXIT: 'gallery',
}
},
leave: {
on: {
CONFIRM: 'galleries',
CANCEL: 'gallery'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment