Chapter 6. Titanium Objects
Now that we’ve seen some of what Titanium can do, let’s take a look at some of what’s running things behind the scenes. iOS and Android platforms are very object-oriented, with everything in the app represented as one object or another.
Many objects share common properties and methods. Titanium has a
number of base objects (the
the most frequently inherited from) that all the other objects are based on.
This allows you to know what kind of properties, methods, etc. are available
on an object that is based on a view. For instance, a view has width and
height properties. Since a button is based on a view, then a button also has
width and height properties. At a UI level, most objects have these common
properties and make it easier to know what you can do with a given
App object is a good one to
start with because it gives you access to things that happen at the “App”
level. It represents the currently running app, and serves as a namespace
that is available to any process running in any window in the app. This
means that an event handler anywhere in the app can always access the
App object. Depending on how you set up
objects that you create.
App object contains interfaces to some very useful functions, such as the ability to store app-related data easily, capture events when the app goes into the background and comes back into the foreground, fire local ...