Skip to content

Instantly share code, notes, and snippets.

@GABAnich
Created July 15, 2021 18:33
Show Gist options
  • Save GABAnich/12ccf902702db6bfaf0479d4bc7082fa to your computer and use it in GitHub Desktop.
Save GABAnich/12ccf902702db6bfaf0479d4bc7082fa 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 fetchMachine = Machine({
id: 'lightDelay',
initial: 'green',
states: {
green: {
after: {
// after 1 second, transition to yellow
1000: { target: 'yellow' }
}
},
yellow: {
after: {
// after 0.5 seconds, transition to red
500: { target: 'red' }
}
},
red: {
after: {
// after 2 seconds, transition to green
2000: { target: 'green' }
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment