Spaces:
Runtime error
Runtime error
using Genie.Renderer.Html, Stipple, StippleUI | |
mutable struct Model <: ReactiveModel | |
process::R{Bool} = false | |
output::R{String} = "" | |
input::R{String} = "" | |
end | |
function handlers(model) | |
on(model.process) do _ | |
if (model.process[]) | |
model.output[] = model.input[] |> reverse | |
model.process[] = false | |
end | |
end | |
model | |
end | |
function ui(model) | |
page(model, class="container", [ | |
p([ | |
"Input " | |
input("", (:input), ("keyup.enter", "process = true")) | |
]) | |
p([ | |
button("Action!", ("process = true")) | |
]) | |
p([ | |
"Output: " | |
span("", (:output)) | |
]) | |
] | |
) | |
end | |
route("/") do | |
model = Model |> init |> handlers | |
html(ui(model), context = | )|
end | |
#Genie.isrunning(:webserver) || up() | |