Last active
November 10, 2019 13:20
-
-
Save jpwesselink/1362045e73b13f3f788a620dcf84f32f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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