Last active
February 17, 2020 00:54
-
-
Save ifyoumakeit/667d57804dd9ceeb4c0436518f57df33 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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