Skip to content

Instantly share code, notes, and snippets.

@phanimurari
Last active April 25, 2022 17:49
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 phanimurari/bbe8d05ffc7a1a966f5a1059ea427939 to your computer and use it in GitHub Desktop.
Save phanimurari/bbe8d05ffc7a1a966f5a1059ea427939 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
id: "ATM",
initial : 'idle',
states : {
idle : {
on: {
INSERT_CARD : 'readingCard',
}
},
readingCard : {
on : {
ACCEPT_CARD : 'askingPin',
REJECT_CARD : 'ejectingCard'
}
},
askingPin : {
on : {
ENTER_PIN : 'checkingPin'
}
},
checkingPin : {
on: {
APPROVE_PIN : 'choosingTransaction',
REJECT_PIN : 'askingPin'
}
},
ejectingCard : {
after: {
2000 : 'idle',
}
},
choosingTransaction : {
on: {
CONFIRM_TRANSACTION : 'performingTransaction',
CANCEL : 'ejectingCard'
}
},
performingTransaction : {
after : {
2000 : 'choosingTransaction'
}
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment