Skip to content

Instantly share code, notes, and snippets.

@zettadam
Last active February 25, 2020 06:40
Show Gist options
  • Select an option

  • Save zettadam/2ec7ad6acf0f5ae658f03c4eef4a86a2 to your computer and use it in GitHub Desktop.

Select an option

Save zettadam/2ec7ad6acf0f5ae658f03c4eef4a86a2 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: 'flight-assignment-status',
initial: 'idle',
states: {
idle: {
on: {
CREATE: 'created'
}
},
created: {
on: {
SUBMIT: 'submitted'
}
},
submitted: {
on: {
RESOLVE: 'pending',
REJECT: 'rejected',
CANCEL: 'withdrawn'
}
},
pending: {
on: {
RESOLVE: 'processed'
}
},
processed: {
on: {
PUBLISH: 'published',
RESUBMIT: 'submitted',
WITHDRAW: 'withdrawn'
}
},
rejected: {
on: {
SUBMIT: 'submitted'
}
},
withdrawn: {
on: {
RESUBMIT: 'submitted',
DELETE: 'deleted'
}
},
deleted: {
type: 'final'
},
published: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment