Mobile JavaScript Application Development

Book description

When developing apps for the latest smartphones, you’re faced with several vexing questions. How many platforms do you need to accommodate? What level of support do mobile browsers provide? To help you address these and many other key issues, this guide provides a hands-on tour of the most powerful JavaScript frameworks available today.

You’ll build sample apps with jQuery Mobile, Sencha Touch, and PhoneGap to learn the unique advantages—and disadvantages—of each framework. From there, you can determine which one is best for your project. This book is ideal for web developers familiar with JavaScript, HTML, and CSS.

  • Experience the simplicity of jQuery Mobile for building cross-browser applications
  • Learn how Sencha Touch’s architecture, widgets, and blazing-fast rendering engine makes it a good choice for enterprise software
  • Use PhoneGap to package your web app into a native iOS, Android, or Windows Phone application
  • Discover the impact of various HTML5 features on mobile app development
  • Pick up JavaScript productivity tips as you delve into its object orientation, closures, and coding conventions
  • Test and debug your app with a collection of tips, tricks, and tools

Table of contents

  1. Mobile JavaScript Application Development
  2. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  3. A Note Regarding Supplemental Files
  4. Preface
    1. Introduction
    2. Fragmentation
    3. Growth of the Mobile Web
    4. New Paradigms
    5. Who Should Read This Book
    6. Book Structure
    7. What You Need
    8. Code of the Book
    9. Acknowledgements
    10. Conventions Used in This Book
    11. Using Code Examples
    12. Safari® Books Online
    13. How to Contact Us
  5. 1. HTML5 for Mobile Applications
    1. A Bit of History
    2. Declarations and Meta Tags
      1. A Minimal HTML5 Document
      2. Doctype
      3. Charset
      4. JavaScript and Stylesheets
      5. New and Obsolete Elements
    3. HTML5 Applications
      1. Add Web Apps to Home Screen in iOS
      2. Add Web Apps to Home Screen in Android
      3. Metadata for HTML5 Applications
    4. HTML5 Application Cache
      1. Manifest Files in Apache
      2. Manifest Files with PHP
      3. Manifest Files in IIS
      4. Manifest Files in .NET
      5. Debugging Manifest Files
    5. Testing for HTML5 Features
    6. Geolocation
    7. Device Orientation
    8. Device Motion
    9. Network Connectivity
    10. Canvas
    11. CSS3 Animations and Transitions
      1. Transitions
      2. Animations
      3. Final Considerations
    12. Client-Side Storage
      1. SQL Storage
    13. Rich Media Tags
    14. Conclusion
  6. 2. JavaScript Productivity Tips
    1. About JavaScript
      1. Some Coding Tips
    2. Object Literals
    3. Single or Double Quotes?
    4. JavaScript Base Types
    5. Dynamic Overloading of Base Types
    6. Functions
    7. How to Organize Code in namespaces
    8. Create Objects and Arrays the Easy Way
    9. Create a Singleton Object
    10. Scheduling Function Execution
    11. Concatenating Strings
    12. Iterating Over Arrays
    13. Using toString() for Reflection
    14. Easy Code Injection
    15. Object-Oriented Programming in JavaScript
      1. The self Trick
      2. More Ways to Do the Same Thing
      3. Another Common Way to Create Custom Types
      4. Passing Options
    16. Conclusion
  7. 3. jQuery Mobile
    1. Supported Platforms
      1. Compatibility
      2. Compatibility with Older Mobile Platforms
    2. Key Features
    3. At a Glance
    4. To Do List Application
      1. The HTML File
      2. Pages
      3. Lists
      4. Buttons
      5. Customizing the Look and Feel
      6. Navigation
      7. Page Lifecycle
      8. Forms
      9. Plug-ins
      10. Storage
    5. Codiqa
    6. ThemeRoller
    7. Conclusion
  8. 4. Sencha Touch
    1. Introduction and History
    2. Characteristics
    3. Supported Platforms
    4. Key Features
      1. GUI Controls
      2. CSS Transitions and Animations
      3. Touch Event Management
      4. Application Data Support
    5. JavaScript Idioms
      1. Descriptive Dictionary Pattern
      2. Object Orientation in Sencha Touch
    6. Creating a To Do List App
      1. Create the HTML
      2. Starting the Application Code
      3. Transitions
      4. Creating Instances
      5. Stores, Proxies, Writers, and Readers
      6. The Data Model
      7. Creating the List
      8. Creating a To Do Item Form
      9. A Controller to Rule Them All
      10. Reacting to Events
      11. Navigation
    7. Using Sencha Architect 2
    8. Conclusion
  9. 5. PhoneGap
    1. Introduction
      1. Supported Platforms
      2. Supported Features
      3. Basic Usage
    2. Installing PhoneGap
    3. Creating an iOS Application
    4. Creating an Android Application
      1. With Eclipse
      2. With IntelliJ IDEA
    5. Creating a Windows Phone Application
    6. Accessing Native Functionality
    7. Plug-ins
    8. The JavaScript Bridge
      1. PhoneGap Kitchen Sink
      2. The deviceready Event
      3. Multitasking Events
      4. Network Connectivity Events
      5. Battery Events
      6. Accelerometer
      7. Address Book
      8. Audio Recording and Playback
      9. Camera
      10. Connection Status
      11. Filesystem
      12. Location and Compass
      13. Notifications
      14. Storage
    9. Conclusion
  10. 6. Debugging and Testing
    1. Your Browser Web Inspector
      1. Inspect the HTML of your app
      2. Log Messages in the Console
      3. Set Breakpoints in Your JavaScript Code
    2. iWebInspector
    3. Adobe Shadow
    4. Testing
      1. Jasmine
      2. Siesta
    5. Conclusion
  11. 7. Conclusion
  12. Bibliography
    1. Books
    2. Generic References about Mobile Web Technologies
    3. Websites about HTML5
    4. Websites about CSS3
    5. Websites about JavaScript
    6. Other Frameworks
  13. About the Author
  14. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  15. Copyright

Product information

  • Title: Mobile JavaScript Application Development
  • Author(s): Adrian Kosmaczewski
  • Release date: June 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449327811