Created
December 21, 2019 17:49
-
-
Save GuyHarwood/1ee228df0d57d13e8d2ae0370b8cb17f 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
const checkMachine = Machine({ | |
id: 'check', | |
initial: 'untaken', | |
context: { | |
restarts: 0 | |
}, | |
states: { | |
untaken: { | |
on: { | |
ALLOCATE: 'allocated' | |
} | |
}, | |
allocated: { | |
on: { | |
LOGIN: 'collected' | |
} | |
}, | |
collected: { | |
on: { | |
RECEIVED: 'submitted' | |
} | |
}, | |
submitted: { | |
on: { | |
PROCESSING_FAILED: 'rejected', | |
PROCESSING_SUCCESS: 'complete' | |
} | |
}, | |
complete: { | |
type: 'final' // can we restart after completion? | |
}, | |
rejected: { | |
on: { | |
RESTART: 'untaken' // TODO context.restarts++ | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment