Skip to content

Instantly share code, notes, and snippets.

@msell
Last active November 13, 2020 19:32
Show Gist options
  • Select an option

  • Save msell/3ba0d4b3638dc5ec1abf96c6aecc1937 to your computer and use it in GitHub Desktop.

Select an option

Save msell/3ba0d4b3638dc5ec1abf96c6aecc1937 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: 'office-LED',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
WORK: 'working',
CHILL: 'chilling',
PARTY: 'partying',
}
},
working: {
initial: 'all_good',
states: {
all_good: {
on: {
CI_FAILED: 'oh_shit',
}
},
oh_shit:{
on: {
CI_PASSING: 'all_good',
}
},
hist: {
type: 'history',
history: 'deep'
},
},
on: {
CHILL: 'chilling',
PARTY: 'partying',
STOP: 'idle',
DEPLOY: 'alerting',
}
},
alerting: {
on: {
COMPLETE: 'working.hist'
}
},
chilling: {
on: {
STOP: 'idle',
PARTY: 'partying',
WORK: 'working',
}
},
partying: {
on: {
STOP: 'idle',
CHILL: 'chilling',
WORK: 'working',
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment