You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing this will require serious thinking about (multi-)client-server state syncing - I think leaving it as is so that only a changed value triggers the handlers might be the most practical. This is what Vue does afaict.
The count examples can be changed to:
function counter(start=0)
w = Widget()
# updates to this update the UI
count = Observable(w, "count", start)
onjs(count,
WebIO.@js x->this.dom.querySelector("#count").textContent = x)
# button clicks send changes to Julia via the `count` observable,
# we print its current value to stdout
on(count) do c
println("count changed to $(count[])")
end
btn(label, d) = dom"button"(label,
events=Dict("click" => WebIO.@js () -> $count[] = $count[] + $d))
w(
dom"div"(
btn("increment", 1),
btn("decrement", -1),
dom"div#count"(string(count[])),
)
)
end
Right now the "counter" examples are broken since updating with the same value drops the update.
The text was updated successfully, but these errors were encountered: