Created
March 19, 2020 18:30
-
-
Save lozandier/a7ff7c8f9c7bc157d1929f32ca25d68e 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: 'spaceHeater', | |
initial: 'poweredOff', | |
states: { | |
poweredOff: { | |
on: { TOGGLE_POWER: 'poweredOn' }, | |
}, | |
poweredOn: { | |
on: { TOGGLE_POWER: 'poweredOff' }, | |
type: 'parallel', | |
states: { | |
heated: { | |
initial: 'lowHeat', | |
states: { | |
lowHeat: { | |
on: { TOGGLE_HEAT: 'lowHeat' }, | |
}, | |
highHeat: { | |
on: { TOGGLE_HEAT: 'highHeat' }, | |
}, | |
}, | |
}, | |
oscillation: { | |
initial: 'disabled', | |
states: { | |
disabled: { | |
on: { TOGGLE_OSC: 'enabled' }, | |
}, | |
enabled: { | |
on: { TOGGLE_OSC: 'disabled' }, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment