Skip to content

Instantly share code, notes, and snippets.

@jinnkhan88
Last active June 6, 2021 18:52
Show Gist options
  • Save jinnkhan88/7d45806597c8022f75364413e9efc4a3 to your computer and use it in GitHub Desktop.
Save jinnkhan88/7d45806597c8022f75364413e9efc4a3 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const spaceHeaterMachine = Machine({
id: 'spaceHeater',
initial: 'poweredOff',
states: {
poweredOff: {
on: { TOGGLE_POWER: 'poweredOn.hist' }
},
poweredOn: {
on: { TOGGLE_POWER: 'poweredOff' },
type:'parallel',
states: {
heated:{
initial:'low',
states:{
low: {
on: { TOGGLE_HEAT: 'high' }
},
high: {
on: { TOGGLE_HEAT: 'low' }
}
}
},
occilation:{
initial:'disabled',
states:{
enabled:{
on:{TOOGLE_OSC:'disabled'}
},
disabled:{
on:{TOOGLE_OSC:'enabled'}
}
}
},
hist: {
type: 'history',
history:'deep'
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment