Last active
April 25, 2022 17:49
-
-
Save phanimurari/bbe8d05ffc7a1a966f5a1059ea427939 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 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