Created
October 12, 2020 06:58
-
-
Save dpwolfe/a20f91aca769686edb90e1023032edb1 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 machine = Machine({ | |
id: 'live-state', | |
initial: 'pending', | |
context: { | |
enabled: false, | |
up: false, | |
}, | |
states: { | |
pending: { | |
on: { | |
UP: 'up', | |
}, | |
after: { | |
3000: 'down', | |
}, | |
}, | |
up: { | |
entry: assign({ up: true }), | |
on: { | |
UP: 'up', | |
}, | |
after: { | |
3000: 'down', | |
}, | |
}, | |
down: { | |
entry: assign({ up: false }), | |
on: { | |
UP: 'up', | |
}, | |
}, | |
}, | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment