Skip to content

Instantly share code, notes, and snippets.

@betocantu93
Created October 20, 2020 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betocantu93/d18df9a19c170ff32835d9d2be174e61 to your computer and use it in GitHub Desktop.
Save betocantu93/d18df9a19c170ff32835d9d2be174e61 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: "action",
initial: "created",
states: {
created: {
on: {
ASSIGN: "pending",
CANCEL: "canceled",
},
meta: {
ASSIGN: {},
CANCEL: {
type: "warn",
icon: "cancel",
},
},
},
pending: {
on: {
START: "in_progress",
CANCEL: "canceled",
},
meta: {
START: {},
CANCEL: {
type: "warn",
icon: "cancel",
},
},
},
in_progress: {
on: {
PROPOSE: "ready",
CANCEL: "canceled",
},
meta: {
PROPOSE: {
type: "primary",
},
CANCEL: {
type: "warn",
icon: "cancel",
},
},
},
ready: {
on: {
DECLINE: "declined",
CLOSE: "done",
CANCEL: "canceled",
},
meta: {
DECLINE: {},
CLOSE: {},
CANCEL: {
type: "warn",
icon: "cancel",
},
},
},
declined: {
on: {
CORRECT: "in_progress",
CANCEL: "canceled",
},
meta: {
CORRECT: {},
CANCEL: {
type: "warn",
icon: "cancel",
},
},
},
canceled: {
on: {
ENABLE: "created",
},
meta: {
ENABLE: {
icon: "restore",
},
},
},
done: {
type: "final",
},
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment