Skip to content

Commit

Permalink
feat(syntax): add keyword for defining and publishing events
Browse files Browse the repository at this point in the history
  • Loading branch information
plusgut committed Dec 2, 2023
1 parent 2b13a7b commit 30dd020
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/components/example/todo.sly
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ reducer = \state@{ todos }, ToggleDone(index) ->

main : \{}, {} -> Output
main = \_, _ ->
let action: Topic<Action> = #
event action: Topic<Action>
let state = action:scan(reducer, { currentText = "", todos = [] })

$link{
href="./todo.css"
rel="stylesheet"
}
$form{
onsubmit = \_ -> #action = CreateTodo
onsubmit = \_ -> publish action = CreateTodo
}
$input{
type = "text"
value = state.textValue
oninput = \evt ->
#action = ChangeText(evt.currentTarget.value)
publish action = ChangeText(evt.currentTarget.value)
}
$button{
type = "submit"
Expand All @@ -51,6 +51,6 @@ main = \_, _ ->
$li{
class = "row"
class?done = isDone
onclick = \_ -> #action = ToggleDone(index)
onclick = \_ -> publish action = ToggleDone(index)
}
"${value}"

0 comments on commit 30dd020

Please sign in to comment.