Last active
May 19, 2020 08:45
-
-
Save vinaysshenoy/4e8628aa35c8f8afd146e6d2d05fe776 to your computer and use it in GitHub Desktop.
Exploratory DSL for rendering a representing a Mobius graph
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
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