Skip to content

Instantly share code, notes, and snippets.

@wmhartl
Last active July 23, 2020 14:45
Show Gist options
  • Save wmhartl/26c0da0ff9cbba268bf23916cb7f7e47 to your computer and use it in GitHub Desktop.
Save wmhartl/26c0da0ff9cbba268bf23916cb7f7e47 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 incidentMachine = Machine({
id: 'incident',
initial: 'Preparing',
context: {
retries: 0
},
states: {
Preparing: {
on: {
SAVE: 'Preparing',
SUBMIT: 'Prioritizing',
DELETE: 'Deleted'
}
},
Prioritizing: {
on: {
SAVE: 'Prioritizing',
RETURN: 'Preparing',
APPROVE: 'Investigating',
REJECT: 'Rejected'
}
},
Investigating: {
on: {
SAVE: 'Investigating',
RESOLVE: 'Resolved',
CLOSE: 'Closed'
}
},
Resolved: {
on: {
REOPEN: 'Investigating',
CLOSE: 'Closed',
ARCHIVE: 'Archived'
}
},
Closed: {
on: {
REOPEN: 'Investigating',
ARCHIVE: 'Archived',
DELETE: 'Deleted'
}
},
Rejected: {
on: {
RETURN: 'Preparing',
ARCHIVE: 'Archived',
DELETE: 'Deleted'
},
type: 'final'
},
Archived: {
on: {
DELETE: 'Deleted'
},
type: 'final'
},
Deleted: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment