Skip to content

Instantly share code, notes, and snippets.

@wmhartl
Last active July 23, 2020 15:20
Show Gist options
  • Save wmhartl/6849c97ce67ffb109332f41031cbae6a to your computer and use it in GitHub Desktop.
Save wmhartl/6849c97ce67ffb109332f41031cbae6a 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 taskMachine = Machine({
id: 'task',
initial: 'Ready',
context: {
retries: 0
},
states: {
Ready: {
on: {
ACCEPT: 'Planning',
ASSIGN: 'Planning',
REJECT: 'Rejected',
DELETE: 'Deleted'
}
},
Planning: {
on: {
SAVE: 'Planning',
START: 'Executing',
REASSIGN: 'Ready',
REJECT: 'Rejected'
}
},
Executing: {
on: {
SAVE: 'Executing',
ESCALATE: 'Ready',
COMPLETE: 'Completed'
}
},
Completed: {
on: {
REOPEN: 'Executing',
DELETE: 'Deleted'
},
type: 'final'
},
Deleted: {
type: 'final'
},
Rejected: {
on: {
RETURN: 'Ready',
DELETE: 'Deleted'
},
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment