Skip to content

Instantly share code, notes, and snippets.

@cbenz
Last active January 22, 2021 23:30
Show Gist options
  • Save cbenz/4030b7cf08f567ea2df7b64423d29c91 to your computer and use it in GitHub Desktop.
Save cbenz/4030b7cf08f567ea2df7b64423d29c91 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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