Created
November 16, 2020 10:34
-
-
Save unludo/97dac540a888201f6706e09d30d7b85e 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 fuMachine = Machine( | |
| { | |
| id: 'promise', | |
| initial: 'connecting', | |
| context: { | |
| sstEndpointClient: null, | |
| sstEndpointInstanceInfo: null, | |
| fuStream: null, | |
| }, | |
| states: { | |
| connecting: { | |
| initial: 'waiting_instance', | |
| states: { | |
| waiting_instance: { | |
| }, | |
| waiting_fu: { | |
| }, | |
| waiting_instance_error: { | |
| entry: [send('ERROR'), (_) => console.info('entering waiting_instance_error')], | |
| }, | |
| fu_connected_to_sst_endpoint: { | |
| entry: [send('FU_CONNECTED'), (_) => console.info('entering fu_connected')], | |
| }, | |
| waiting_fu_error: { | |
| entry: [send('ERROR'), (_) => console.info('entering waiting_fu_error')], | |
| }, | |
| }, | |
| on: { | |
| FU_CONNECTED: 'connected', | |
| ERROR: 'error', | |
| }, | |
| }, | |
| timeout_waiting_fu: { | |
| // to final state | |
| }, | |
| connected: { | |
| on: { | |
| START_LIVE: 'live_starting', | |
| }, | |
| }, | |
| disconnecting: {}, | |
| live_starting: { | |
| initial: 'waiting_sh_ip', | |
| states: { | |
| waiting_sh_ip: { | |
| on: { | |
| IP_SH: 'connecting_to_sh', | |
| }, | |
| }, | |
| connecting_to_sh: { | |
| on: { | |
| SH_CONNECTED: 'connected_to_sh', | |
| }, | |
| }, | |
| connected_to_sh: {}, | |
| }, | |
| on: { | |
| FU_IN_LIVE: 'live', | |
| }, | |
| }, | |
| live: { | |
| on: { | |
| STOP_LIVE: 'stopping', | |
| }, | |
| }, | |
| stopping: {}, | |
| error: { | |
| type: 'final', | |
| entry: 'manageError', | |
| }, | |
| }, | |
| }, | |
| { | |
| actions: { | |
| manageError: async (context, event) => { | |
| console.error(`There was on error in the state diagram`); | |
| }, | |
| }, | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment