Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Last active September 28, 2020 17:51
Show Gist options
  • Save tomByrer/7dc16d2a8841d37e82115114eb5d1b7e to your computer and use it in GitHub Desktop.
Save tomByrer/7dc16d2a8841d37e82115114eb5d1b7e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const radioItem = Machine(
{
id: 'checkbox',
initial: 'nix',
states: {
nix: {
on: {
DISABLE: 'nixDisabled',
SELECT: 'aver',
},
},
nixDisabled: {
on: {
ENABLE: 'nix',
},
},
aver: {
entry: ['enterAver'],
exit: ['exitAver'],
on: {
RESET: 'nix',
AFFIRM: 'affirmed',
NEGATE: 'negated',
},
},
affirmed: {
type: 'final',
},
negated: {
on: {
DISABLE: 'negatedDisabled'
},
},
negatedDisabled: {
type: 'final',
},
},
},
{
actions: {
enterAver: () => {
console.log("enterAver");
},
exitAver: () => {
console.log("exit Aver");
},
},
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment