Skip to content

Instantly share code, notes, and snippets.

@jpwesselink
Last active November 10, 2019 13: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 jpwesselink/1362045e73b13f3f788a620dcf84f32f to your computer and use it in GitHub Desktop.
Save jpwesselink/1362045e73b13f3f788a620dcf84f32f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const connectionCheckerMachine = Machine({
id: 'networkConnection',
initial: 'offline',
states: {
offline: {
after: {
3000: 'connecting'
},
on: {
ESTABLISH_CONNECTION: 'connecting'
}
},
connecting: {
on: {
CONNECTION_CREATED: 'online',
COULD_NOT_CREATE_CONNECTION: 'offline'
}
},
online: {
on: {
QUIT_APP: 'teardown',
CONNECTION_DROPPED: 'offline'
}
},
teardown: { type: 'final' }
}
});
// const applicationMachine = Machine({
// id: 'applicationMachine',
// context: {},
// initial: 'whatever',
// states: {
// whatever: {
// on: { MEKKER: 'whatever' },
// ...connectionCheckerMachine
// }
// }
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment