Skip to content

Instantly share code, notes, and snippets.

@emyann
Created February 20, 2019 23:40
Show Gist options
  • Save emyann/46cac71aa26fee84b853df63f0bb959c to your computer and use it in GitHub Desktop.
Save emyann/46cac71aa26fee84b853df63f0bb959c to your computer and use it in GitHub Desktop.
Jive State Machine
// XState https://statecharts.github.io/xstate-viz/
const lightMachine = Machine({
id: 'light2',
initial: 'standing',
states: {
standing: {
on: { startOutgoingCall: 'waitForAnswer' },
on: { startIncomingCall: 'ringing' }
},
waitForAnswer: {
on: { startOutgoingConversation: 'conversation' },
on: { timeoutOutgoingCall: 'standing' }
},
ringing: {
on: { startIncomingConversation: 'conversation' },
on: { timeoutIncomingCall: 'standing' }
},
conversation: {
on: { endConversation: 'standing' }
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment