JuliaGizmos / Escher.jl

Composable Web UIs in Julia
https://juliagizmos.github.io/Escher.jl
Other
337 stars 63 forks source link

Hasstate for multiple attributes/triggers + immediate values on slider #178

Closed izaid closed 8 years ago

izaid commented 8 years ago

This PR adds two new things to Escher.jl.

The first is a slight reworking of hasstate, leading to the new function hasstates. The function hasstates is similar to hasstate, but takes a Dict of attribute / event pairs as input and watches all of them. This allows for more complex observations.

The second is a new keyword immediate on slider. If this is set to true, the slider will watch both the value and the immediateValue properties using hasstates. This allows the signal to be updated immediately while the user drags the slider. The default value of immediate is false.

This PR effectively solves https://github.com/shashi/Escher.jl/issues/147. All one has to do now is slider(r, immediate=true).

This PR is ready for review / merging.

shashi commented 8 years ago

Nice! :) Can we make hasstate a special case of hasstates and then rename hasstates to hasstate? Basically the new hasstate will take a dict of 1 element.

izaid commented 8 years ago

@shashi Done. I would consider deprecating hasstate in an upcoming release.

shashi commented 8 years ago

much better. Yes, that would be nice.