Last active
May 8, 2020 21:57
-
-
Save kelchm/98746b6910ebc0148ea01f6d2557d5bd 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
const hasDelinquencies = () => true; | |
const hasInsufficientFunds = () => false; | |
const financialPlanMachine = Machine({ | |
id: 'financialPlan', | |
initial: 'checkingForDisqualification', | |
states: { | |
checkingForDisqualification: { | |
on: { | |
FINISH_DISQUALIFICATION: [ | |
{ | |
target: 'disqualified.delinquencyThresholdExceeded', | |
cond: hasDelinquencies, | |
}, | |
{ | |
target: 'disqualified.insufficientFunds', | |
cond: hasInsufficientFunds, | |
}, | |
{ | |
target: 'displayPlan', | |
}, | |
], | |
}, | |
}, | |
disqualified: { | |
type: 'parallel', | |
states: { | |
delinquencyThresholdExceeded: {}, | |
insufficientFunds: {} | |
}, | |
on: { | |
USER_INPUT: 'checkingForDisqualification', | |
}, | |
}, | |
displayPlan: { | |
on: { | |
USER_INPUT: 'checkingForDisqualification', | |
}, | |
}, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment