Last active
March 12, 2020 11:22
-
-
Save anru/95453d58519b622c7729b00e3f7b0997 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 timerMachine = Machine({ | |
id: 'timer', | |
initial: 'active', | |
states: { | |
active: { | |
after: { | |
2000: 'finished' // 2 seconds | |
} | |
}, | |
finished: { type: 'final' } | |
} | |
}) | |
const screensMachine = Machine({ | |
id: 'screens', | |
initial: 'form', | |
states: { | |
form: { | |
invoke: { | |
src: timerMachine, | |
onDone: 'greet' | |
} | |
}, | |
greet: { on: { back: 'form', next: 'result' } }, | |
result: { on: { back: 'greet' } }, | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment