Skip to content

Instantly share code, notes, and snippets.

@farskid
Created July 29, 2021 10:48
Show Gist options
  • Save farskid/d9e9145d09f037ce8c284c3593665215 to your computer and use it in GitHub Desktop.
Save farskid/d9e9145d09f037ce8c284c3593665215 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fileMachine = Machine({
id: "file",
type: "parallel",
states: {
upload: {
initial: "idle",
states: {
idle: {
on: {
INIT_UPLOAD: { target: "pending" },
},
},
pending: {
on: {
UPLOAD_COMPLETE: { target: "success" },
},
},
success: {},
},
},
download: {
initial: "idle",
states: {
idle: {
on: {
INIT_DOWNLOAD: { target: "pending" },
},
},
pending: {
on: {
DOWNLOAD_COMPLETE: { target: "success" },
},
},
success: {},
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment