Last active
January 22, 2021 23:30
-
-
Save cbenz/4030b7cf08f567ea2df7b64423d29c91 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
Machine({ | |
id: 'game1', | |
initial: 'betting', | |
context: { | |
betAmount: 0, | |
counterValue: 0 | |
}, | |
states: { | |
betting: { | |
on: { | |
BET: { | |
target: '', | |
actions: assign({ betAmount: 42 }) | |
}, | |
START: { | |
target: 'playing', | |
cond: context => context.betAmount > 0 | |
} | |
} | |
}, | |
playing: { | |
on: { | |
INC: { | |
target: '', | |
actions: assign({ counterValue: context => context.counterValue + 1 }) | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment