Skip to content

Instantly share code, notes, and snippets.

@anru
Last active March 12, 2020 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anru/95453d58519b622c7729b00e3f7b0997 to your computer and use it in GitHub Desktop.
Save anru/95453d58519b622c7729b00e3f7b0997 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// 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