While we have already touched briefly on one use of the
Observable component when we discussed the model file in Chapter 2, The Project Structure, let us go more in-depth on this component.
This component has two similar responsibilities; both deal with events. First, this class is used as the source class for using any variables that need binding.
By source, I mean this is the class that provides the memory location for you to store your variables that you want to stay in sync with other components and your code. For example, if you look at our created
main-view-model.js property that we discussed in Chapter 2, The Project Structure, it uses the Observable component for the
counter variable and the
tapAction. This is the source class for tracking our
counter variable. The other components and your own code can also listen for
propertyChange events. This event is fired, which allows you to react anytime that property or variable is changed. The NativeScript components, when bound...