Skip to content

Instantly share code, notes, and snippets.

@kellyjandrews
Last active June 30, 2020 04:58
Show Gist options
  • Save kellyjandrews/53c4772dc742ce1b84c40e3fa6669c6e to your computer and use it in GitHub Desktop.
Save kellyjandrews/53c4772dc742ce1b84c40e3fa6669c6e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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