As to point two, observable provides a bi-directional binding so that changes to the value are reflected in the DOM and changes in the DOM are reflected in the model.
The observable interface is essentially a jQuery style getter/setter method that allows for observers to be notified of changes.
Looks very nice, just this weekend I looked at some frontend frameworks, including Vue, Mithrill, Ractive and React and found some issues with them all. Hamlet would fit my use case very well, I think. One thing I'd like is more technical details on the main page - not how it "looks like" compared to other frameworks, but how it does its thing (compared to other frameworks).
The Observable component invokes the callback to all listeners immediately when its value is changed. I find this makes testing and debugging somewhat easier than async callbacks or nextTick.
list = Observable []
list.push 'blah'
and isOrange = Observable false
isOrange = true // This obviously doesn't work this way...
Do you poll the value? Or do you check the type of the value and wrap/proxy methods that would normally change the value?The wrappers also set up automatic dependency resolution so you can do cool things like:
list = Observable []
reversed = Observable ->
list.map reverse
list.push 'blah'
reversed() # => ['halb']
There's no polling, the observable notifies all observers immediately when the value changes. isOrange(false)
I have a few questions:
1. Its interesting to see JS events specified in the template (e.g. `%a(onclick=@doSomething)`). Is there a way to specify that in the JS/model?
2. Does "Observable" mean that the value is updated when the model changes, when the DOM changes, or both? Could all of the attributes of the object passed into the template be observable by default or would that incur a significant performance penalty?