Last active
July 30, 2021 14:54
-
-
Save sandwichsudo/d6084f982484639d6c28a80faaf976ae 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 door = Machine({ | |
id: 'door', | |
initial: 'idle', | |
states: { | |
idle: { | |
context: { | |
participants: [], | |
}, | |
on: { | |
CONNECTED: 'inProgress', | |
HANG_UP: 'wrapUp' | |
} | |
}, | |
inProgress: { | |
initial: 'active', | |
states: { | |
active: { | |
on: { | |
HOLD: 'onHold', | |
} | |
}, | |
onHold: { | |
on: { | |
RESUME: 'active', | |
} | |
}, | |
}, | |
on: { | |
HANG_UP: 'wrapUp' | |
}, | |
activities: { | |
listeningToSocket: (context, event) => { | |
// listen to Twilio websocket | |
return () => { | |
// clean up websocket | |
} | |
} | |
} | |
}, | |
wrapUp: { | |
on: { | |
RECORD_OUTCOME: 'idle' | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment