Last active
June 30, 2020 04:58
-
-
Save kellyjandrews/53c4772dc742ce1b84c40e3fa6669c6e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 video = Machine({ | |
id: 'video', | |
initial: 'disconnected', | |
states: { | |
disconnected: { | |
id: 'disconnected', | |
initial: 'idle', | |
states: { | |
'idle': { | |
id: 'idle', | |
on: { | |
'START': 'init' | |
} | |
}, | |
'init': { | |
id: 'init', | |
on: { | |
'VIDEO_ELEMENT_CREATED': { | |
target: 'ready', | |
cond: 'checkToken' | |
} | |
} | |
}, | |
'ready': { | |
id: 'ready', | |
on: { | |
'CONNECT': '#connected' | |
} | |
} | |
} | |
}, | |
connected: { | |
id: 'connected', | |
type: 'parallel', | |
states: { | |
'session': { | |
id: 'session', | |
}, | |
'subscriber': { | |
id: 'subscriber', | |
}, | |
'publisher': { | |
id: 'publisher', | |
} | |
}, | |
on: { | |
'DISCONNECT': '#disconnected' | |
} | |
} | |
} | |
},{ | |
guards: { | |
checkToken: () => true | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment