Last active
June 10, 2020 23:49
-
-
Save markbjerke/c170286eb9c3ff3bcbfebcad0c122f2d 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) | |
/** | |
* A visualization of | |
*/ | |
Machine({ | |
id: 'appstate', | |
context: { | |
data: undefined | |
}, | |
initial: 'Workstation', | |
states: { | |
Workstation: { | |
initial: 'Setup', | |
on: { | |
SHUTDOWN: { | |
target: '.Shutdown', | |
actions: ['appShutdown'] | |
}, | |
}, | |
states: { | |
Setup: { | |
on: { | |
WKS_READY: 'Active' | |
} | |
}, | |
Error: { | |
// add error handler on entry here... | |
}, | |
Shutdown: { | |
}, | |
Active: { | |
initial: 'Idle', | |
on: { | |
MODE_PSS: '.Application.PSS', | |
MODE_SRF: '.Application.SRF', | |
MODE_LAUNCHER: '.Application.Launcher', | |
SETUP_TIMEOUT: '.Error', | |
Shutdown: 'Shutdown' | |
}, | |
states: { | |
Idle: {}, | |
Error: {}, | |
Application: { | |
states: { | |
PSS: { | |
initial: 'Setup', | |
states: { | |
Setup: { | |
on: {Load: 'Active'} | |
}, | |
Active: { | |
on: {Shutdown: 'Shutdown'} | |
}, | |
Shutdown: { | |
entry: send('Shutdown') | |
} | |
} | |
}, | |
SRF: { | |
initial: 'Setup', | |
states: { | |
Setup: { | |
on: {Load: 'Active'} | |
}, | |
Active: { | |
on: {Shutdown: 'Shutdown'} | |
}, | |
Shutdown: { | |
entry: send('Shutdown') | |
} | |
} | |
}, | |
Launcher: { | |
initial: 'Setup', | |
states: { | |
Setup: { | |
on: {Load: 'Active'} | |
}, | |
Active: { | |
on: {Shutdown: 'Shutdown'} | |
}, | |
Shutdown: { | |
entry: send('Shutdown') | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
actions: { | |
appShutdown: (context, event) => console.log('appShutdown'), | |
}, | |
guards: { | |
isPSSContext: (context, event) => {'app_state_PSS' === event.NewContext}, | |
isSRFContext: (context, event) => {'app_state_SRF' === event.NewContext}, | |
isLauncherContext: (context, event) => {'app_state_Launcher' === event.NewContext} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment