Created
September 25, 2019 18:39
-
-
Save Laimiux/a09350babafd0ad88f6a986566d43812 to your computer and use it in GitHub Desktop.
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
class StopwatchFormula : Formula<Unit, StopwatchFormula.State, StopwatchRenderModel> { | |
// We will use this a little later. | |
object State | |
override fun initialState(input: Unit): State = State | |
override fun evaluate( | |
input: Unit, | |
state: State, | |
context: FormulaContext<State> | |
): Evaluation<StopwatchRenderModel> { | |
return Evaluation( | |
renderModel = StopwatchRenderModel( | |
timePassed = "5s 10", | |
startStopButton = ButtonRenderModel( | |
text = "Start", | |
onSelected = { /* TODO */ } | |
), | |
resetButton = ButtonRenderModel( | |
text = "Reset", | |
onSelected = { /* TODO */ } | |
) | |
) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment