Skip to content

Instantly share code, notes, and snippets.

@vinaysshenoy
Last active May 19, 2020 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinaysshenoy/4e8628aa35c8f8afd146e6d2d05fe776 to your computer and use it in GitHub Desktop.
Save vinaysshenoy/4e8628aa35c8f8afd146e6d2d05fe776 to your computer and use it in GitHub Desktop.
Exploratory DSL for rendering a representing a Mobius graph
mobius("Login") {
state("Default") {
events {
"InputChanged" leadsTo "Default"
"SubmitClicked" leadsTo "ValidateInput"
}
}
transient("ValidateInput") {
effects {
effect("ValidateInput") {
events {
"ValidationSucceeded" leadsTo "LoggingIn"
"ValidationFailed" leadsTo "InvalidInput"
}
}
}
}
state("InvalidInput") {
events {
"InputChanged" leadsTo "Default"
}
}
state("LoggingIn") {
effects {
effect("LogIn") {
events {
"RequestFailedWithNetworkError" leadsTo "RequestFailed"
"LoginSucceeded" leadsTo "SaveUser"
"IncorrectCredentialsEntered" leadsTo "IncorrectCredentials"
}
}
}
}
state("RequestFailed") {
events {
"Retry" leadsTo "LoggingIn"
}
}
transient("SaveUser") {
effects {
effect("SaveUser") {
events {
"UserSaved" leadsTo "GoToHomeScreen"
}
}
}
}
transient("GoToHomeScreen") {
effects {
effect("GoToHomeScreen")
}
}
state("IncorrectCredentials") {
events {
"InputChanged" leadsTo "Default"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment