Skip to content

Instantly share code, notes, and snippets.

@mrtnpar
Created August 13, 2021 05:44
Show Gist options
  • Save mrtnpar/11338e28749f2e929307c4031c122e9c to your computer and use it in GitHub Desktop.
Save mrtnpar/11338e28749f2e929307c4031c122e9c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const expMachine = Machine({
id: 'experiments',
type: 'parallel',
context: {
a: true,
b: false,
c: true,
d: true
},
states: {
a: {
initial: 'initial',
states: {
initial: {
always: [
{ target: 'enabled', cond: (context) => context.flags.a },
{ target: 'disabled', cond: (context) => !context.flags.a }
]
},
enabled: {},
disabled: {}
}
},
b: {
initial: 'initial',
states: {
initial: {
always: [
{ target: 'enabled', cond: (context) => context.flags.b },
{ target: 'disabled', cond: (context) => !context.flags.b }
]
},
enabled: {},
disabled: {}
}
},
c: {
initial: 'initial',
states: {
initial: {
always: [
{ target: 'enabled', cond: (context) => context.flags.c },
{ target: 'disabled', cond: (context) => !context.flags.c }
]
},
enabled: {},
disabled: {}
}
},
d: {
initial: 'initial',
states: {
initial: {
always: [
{ target: 'enabled', cond: (context) => context.flags.d },
{ target: 'disabled', cond: (context) => !context.flags.d }
]
},
enabled: {},
disabled: {}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment