Skip to content

Instantly share code, notes, and snippets.

@andrewgordstewart
Created January 10, 2020 20:20
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 andrewgordstewart/33fc0ea54260e93e20e8cfc8002db4da to your computer and use it in GitHub Desktop.
Save andrewgordstewart/33fc0ea54260e93e20e8cfc8002db4da 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: 'pending',
DONE: 'success'
}
},
pending: {
on: {
UPLOAD_COMPLETE: 'success'
}
},
success: {},
},
},
download: {
initial: 'idle',
states: {
idle: {
on: {
INIT_DOWNLOAD: 'pending',
DONE: 'success'
}
},
pending: {
on: {
DOWNLOAD_COMPLETE: 'success'
}
},
success: {}
},
}
}
});
console.log(fileMachine.initialState.value);
// => {
// upload: 'idle',
// download: 'idle'
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment