Created
August 26, 2019 00:00
-
-
Save ShMcK/87c05fae048107ee56f081c67f2b099f 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 fetchMachine = Machine({ | |
id: 'root', | |
initial: 'SelectTutorial', | |
states: { | |
SelectTutorial: { | |
onEntry: ['createWebview'], | |
initial: 'Initial', | |
states: { | |
Initial: { | |
on: { | |
WEBVIEW_INITIALIZED: 'Startup', | |
}, | |
}, | |
Startup: { | |
onEntry: ['newOrContinue'], | |
on: { | |
CONTINUE: 'ContinueTutorial', | |
NEW: 'NewTutorial', | |
}, | |
}, | |
NewTutorial: { | |
initial: 'SelectTutorial', | |
states: { | |
SelectTutorial: { | |
on: { | |
TUTORIAL_START: 'InitializeTutorial', | |
}, | |
}, | |
InitializeTutorial: { | |
onEntry: ['tutorialLaunch'], | |
on: { | |
TUTORIAL_LOADED: '#tutorial', | |
}, | |
}, | |
}, | |
}, | |
ContinueTutorial: { | |
onEntry: ['tutorialContinue'], | |
on: { | |
TUTORIAL_START: '#tutorial-load-next', | |
}, | |
}, | |
}, | |
}, | |
Tutorial: { | |
id: 'tutorial', | |
initial: 'Initialize', | |
onEntry: ['tutorialSetup'], | |
on: { | |
WEBVIEW_INITIALIZED: '#tutorial-load-next' | |
}, | |
states: { | |
Initialize: { | |
onEntry: ['initializeNewTutorial'], | |
after: { | |
0: 'Summary', | |
}, | |
}, | |
LoadNext: { | |
id: 'tutorial-load-next', | |
after: { | |
0: [{ | |
target: 'Stage', | |
cond: 'hasNextStep', | |
}, | |
{ | |
target: 'Stage', | |
cond: 'hasNextStage', | |
}, | |
{ | |
target: 'Level', | |
cond: 'hasNextLevel', | |
}, | |
{ | |
target: '#completed-tutorial', | |
}, | |
], | |
}, | |
}, | |
Summary: { | |
on: { | |
NEXT: 'Level', | |
}, | |
}, | |
Level: { | |
onEntry: ['loadLevel'], | |
on: { | |
NEXT: 'Stage', | |
BACK: 'Summary', | |
}, | |
}, | |
Stage: { | |
onEntry: ['loadStage', 'stepLoadCommits'], | |
initial: 'Normal', | |
states: { | |
Normal: { | |
on: { | |
TEST_RUN: 'TestRunning', | |
STEP_SOLUTION_LOAD: { | |
actions: ['callSolution'], | |
}, | |
}, | |
}, | |
TestRunning: { | |
onEntry: ['testStart'], | |
on: { | |
TEST_PASS: 'TestPass', | |
TEST_FAIL: 'TestFail', | |
}, | |
}, | |
TestPass: { | |
onEntry: ['testPass', 'progressUpdate'], | |
onExit: ['stepLoadNext'], | |
after: { | |
1000: 'StepNext', | |
}, | |
}, | |
TestFail: { | |
onEntry: ['testFail'], | |
after: { | |
0: 'Normal', | |
}, | |
}, | |
StepNext: { | |
after: { | |
0: [ | |
{ | |
target: 'Normal', | |
cond: 'hasNextStep', | |
actions: ['stepLoadCommits'], | |
}, | |
{ | |
target: 'StageComplete', | |
}, | |
], | |
}, | |
}, | |
StageComplete: { | |
on: { | |
STAGE_NEXT: { | |
target: '#tutorial-load-next', | |
actions: ['updatePosition'], | |
}, | |
}, | |
}, | |
}, | |
}, | |
Completed: { | |
id: 'completed-tutorial', | |
type: 'final', | |
}, | |
}, | |
}, | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment