Skip to content

Instantly share code, notes, and snippets.

@wspringer
Last active May 7, 2020 12:40
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 wspringer/0b39da1c03101c7d5c9eb3a42dd847c3 to your computer and use it in GitHub Desktop.
Save wspringer/0b39da1c03101c7d5c9eb3a42dd847c3 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 ConsumerTransferFlowMachine = Machine(
{
id: 'ConsumerTransfer',
initial: 'in_progress',
context: {
actionDate: 3
},
states: {
in_progress: {
on: {
TerminationNotification: [{
target: 'terminated',
cond: 'terminationInTime',
actions: 'TransactionAcknowledgement'
}, {
target: 'in_progress',
actions: 'TransactionAcknowledgement'
}],
},
after: {
4000: 'completed',
},
},
terminated: {
type: 'final'
},
completed: {
type: 'final',
entry: ['ChangeCompleted']
},
},
},
{
guards: {
terminationInTime: (context, event) => actionDate < 2
},
actions: {
ChangeCompleted: () => {
console.info('ChangeCompleted')
},
TransactionAcknowledgement: () => {
console.info('TransactionAcknowledgement')
}
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment