Created
January 16, 2021 19:29
-
-
Save tomByrer/f1a44a49f56811adc3cdf67aa9d067b2 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
// Master machine for radio buttons | |
const inputGroupMachine = Machine({ | |
id: 'input-group', | |
initial: 'emptied', | |
states: { | |
emptied: { | |
on: { | |
FETCH: 'pending', | |
} | |
}, | |
pending: { | |
on: { | |
REJECT: 'failure', | |
FULFILL: 'distributing', | |
} | |
}, | |
failure: { | |
on: { | |
RETRY: 'pending', | |
} | |
}, | |
distributing: { // indivudal items array | |
on: { | |
COMPLETE: 'selectable', | |
// REJECT: 'failure', | |
} | |
}, | |
selectable: { | |
initial: 'empty', | |
states: { | |
empty: { | |
on: { | |
'FILL': 'full', | |
} | |
}, | |
full: { | |
on: { | |
FILL: 'full', // EMPTY old item | |
SUBMIT: 'submitting', | |
// SELECT: 'sending' | |
} | |
}, | |
submitting: { | |
on: { | |
COMPLETE: '#clear-old' | |
} | |
}, | |
} | |
}, | |
clearing: { | |
id: 'clear-old', | |
on: { | |
DONE: 'emptied' | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment