4 ms·
The current implementation performs changes immediately. There is no virtual DOM, as soon as a change occurs the model is update and vice versa. The Observable
by Yahivin 12y ago
The current implementation performs changes immediately. There is no virtual DOM, as soon as a change occurs the model is update and vice versa.
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.
- bradgessler 12y agoHow does observable wrap values? I see a few things: 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?
- Yahivin 12y agoWhen Observable is declared with a type (especially an array) it sets up some wrapped methods to simplify working with it. 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.
- bradgessler 12y agoWhat about simple types, like the `false` value example above? Is there a `set` and `get` method?
- mdiebolt 12y agoYou'd use a jQuery style setter. isOrange(false)