Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with NativeScript

You're reading from   Getting Started with NativeScript Explore the possibility of building truly native, cross-platform mobile applications using your JavaScript skill—NativeScript!

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785888656
Length 168 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Nathanael J. Anderson Nathanael J. Anderson
Author Profile Icon Nathanael J. Anderson
Nathanael J. Anderson
Arrow right icon
View More author details
Toc

Event system


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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime