Last active
July 23, 2020 15:20
-
-
Save wmhartl/6849c97ce67ffb109332f41031cbae6a 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 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