Created
June 30, 2021 22:02
-
-
Save korshunad/d8afb85180aca74314ac18c4628fec84 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const joinDropMachine = Machine( | |
{ | |
id: 'joinDrop', | |
initial: 'unknown', | |
context: {}, | |
states: { | |
unknown: { | |
always: [ | |
{ | |
target: '#countdown', | |
cond: 'isCountingDown', | |
}, | |
{ | |
target: '#waitingRoomOpen', | |
cond: 'isWaitingRoomOpen', | |
}, | |
{ | |
target: '#queueOpen', | |
cond: 'isQueueOpen', | |
}, | |
{ | |
target: '#queueClosed', | |
cond: 'isQueueClosed', | |
}, | |
{ | |
target: '#unavailable', | |
}, | |
], | |
}, | |
unavailable: { | |
id: 'unavailable', | |
on: { | |
COUNTDOWN_OPEN: { | |
target: '#countdown', | |
}, | |
}, | |
}, | |
countdown: { | |
id: 'countdown', | |
initial: 'unknown', | |
on: { | |
WAITING_ROOM_OPEN: { | |
target: '#waitingRoomOpen', | |
}, | |
}, | |
states: { | |
unknown: { | |
always: [ | |
{ | |
target: '#countdown.eligible', | |
cond: 'isEligible', | |
}, | |
{ | |
target: '#countdown.ineligible', | |
}, | |
], | |
}, | |
eligible: { | |
}, | |
ineligible: { | |
}, | |
}, | |
}, | |
waitingRoomOpen: { | |
id: 'waitingRoomOpen', | |
initial: 'unknown', | |
on: { | |
QUEUE_OPEN: { | |
target: '#queueOpen', | |
}, | |
}, | |
states: { | |
unknown: { | |
always: [ | |
{ | |
target: '#waitingRoomOpen.eligible', | |
cond: 'isEligible', | |
}, | |
{ | |
target: '#waitingRoomOpen.ineligible', | |
}, | |
], | |
}, | |
eligible: { | |
}, | |
ineligible: { | |
}, | |
}, | |
}, | |
queueOpen: { | |
id: 'queueOpen', | |
initial: 'unknown', | |
states: { | |
unknown: { | |
always: [ | |
{ | |
target: '#queueOpen.eligible', | |
cond: 'isEligible', | |
}, | |
{ | |
target: '#queueOpen.ineligible', | |
}, | |
], | |
}, | |
eligible: { | |
states: { | |
enqueuing: {}, | |
enqueueFailed: {}, | |
enqueueSuccess: {}, | |
}, | |
on: { | |
GO_TO_QUEUE: { | |
target: '#queueOpen.eligible.enqueuing', | |
}, | |
}, | |
}, | |
ineligible: {}, | |
}, | |
}, | |
queueClosed: { | |
id: 'queueClosed', | |
type: 'final', | |
}, | |
}, | |
}, | |
{ | |
guards: { | |
isCountingDown: () => {}, | |
isWaitingRoomOpen: () => true, | |
isQueueOpen: () => {}, | |
isQueueClosed: () => {}, | |
isEligible: () => {}, | |
isIneligible: () => {}, | |
}, | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment