Skip to content

Instantly share code, notes, and snippets.

@ibrahimcesar
Last active January 23, 2020 14:24
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 ibrahimcesar/4399ed256e32bf89b78a60537249a16e to your computer and use it in GitHub Desktop.
Save ibrahimcesar/4399ed256e32bf89b78a60537249a16e 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 planNytMachine = Machine({
id: 'planNyt',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
COMPRA: 'payment'
}
},
payment: {
on: {
PAID: 'sendCode',
AWAITING: 'checkPaid'
}
},
sendCode: {
type: 'final'
},
checkPaid: {
on: {
PAID: 'sendCode',
RECHECK: 'validate'
}
},
validate: {
on: {
PAID: 'sendCode',
AWAITING: 'checkPaid',
EXPIRED: 'expired'
}
},
expired: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment