Last active
February 23, 2020 00:35
-
-
Save Siunami/00eb48de71dd595bbb1439567397a2c7 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const roomState = { | |
"WAITING":"WAITING", | |
"SUBMITQUESTIONS":"SUBMITQUESTIONS", | |
"RATEQUESTIONS":"RATEQUESTIONS", | |
"SUBMITANSWERS":"SUBMITANSWERS", | |
"RATEANSWERS":"RATEANSWERS", | |
"VIEW":"VIEW", | |
"FOLLOWUP":"FOLLOWUP", | |
"NEWEND":"NEWEND" | |
} | |
const fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'WAITING', | |
context:{ | |
roomState: roomState.WAITING, | |
host: "", | |
participants: [], | |
dat: [], | |
round: -1, | |
subround: -1, | |
ready: 0, | |
branch: [], | |
timerStarted: false | |
}, | |
states: { | |
WAITING: { | |
on: { | |
update_state: 'SUBMITQUESTIONS' | |
} | |
}, | |
SUBMITQUESTIONS: { | |
on: { | |
submitQuestion: 'RATEQUESTIONS' | |
} | |
}, | |
RATEQUESTIONS: { | |
on: { | |
rateQuestion: 'SUBMITANSWERS' | |
} | |
}, | |
SUBMITANSWERS: { | |
on: { | |
submitAnswer: 'RATEANSWERS' | |
} | |
}, | |
RATEANSWERS: { | |
on: { | |
rateAnswer: 'VIEW' | |
} | |
}, | |
VIEW: { | |
on: { | |
readyUp: 'NEWEND' | |
} | |
}, | |
NEWEND: { | |
on:{ | |
newQuestion: 'SUBMITQUESTIONS', | |
leave: 'DASHBOARD' | |
} | |
}, | |
DASHBOARD: { | |
type: 'final' | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment