You are previewing Palm webOS.
O'Reilly logo
Palm webOS

Book Description

A Note from the Author and from O'Reilly Media about what this book does--and doesn't--do: Palm webOS is a brand new platform and represents a very different type of operating system where the web runtime is used as the basis for the UI and Application model. Palm and O'Reilly felt that it was important to have a book available to help developers get a basic understanding of the new Palm platform at the time that the SDK was released; this timing played a major role in the content and structure of the book. Ideally this book would have been a complete reference of the new platform but that wasn't possible since the content was written at the same time as the software SDK was being developed by the Palm engineering team. The book does provide a complete overview of Palm webOS, a thorough description of the application model and gives details on many key design concepts. There are descriptions and examples of UI widgets, services, storage, notifications, dashboards and background applications, serving as a great introduction but not as a definitive source. The book uses a simple News reader application to illustrate the technical descriptions but the examples are not intended to serve as a cookbook tutorial. Experienced developers should be able to use the examples to build up a working application chapter by chapter but others may not find the loose descriptions adequate for recreating the application unaided. Over time, these different needs will be filled by other books, but in the meantime we hope that this book will serve a valuable role introducing developers to webOS and giving them a way of getting started with webOS application development. A second printing of the book will update any original coverage obsoleted by subsequent Mojo SDK builds. For owners of the original printing of the book, all of these updates are posted on the "View/Submit Errata" link (please see left-hand column of this web page). Thanks for understanding that book publishing and coverage of rapidly moving technologies can sometimes be an inexact science; we knew there'd be a need for a book such as *Palm webOS: The Insider's Guide to Developing Applications in JavaScript using the Palm MojoT Framework*, and there's certainly no better person to write that book that Mitch Allen; that said, we understand that because it is such a new operating system and SDK, there would (and will continue to be) changes that at best can't be documented and explored until new printings of the books are released. In the meantime we will be diligent in posting updates to this book's O'Reilly Media catalog page. This is the official guide to building native JavaScript applications for Palm's new mobile operating system, Palm® webOS™. Written by Palm's software chief technology officer along with the Palm webOS development team, Palm webOS provides a complete tutorial on the design principles, architecture, UI, tools, and services necessary to develop webOS applications-including the Mojo JavaScript framework and Palm's SDK. Palm webOS is designed to support a fast and superb user experience using established web standards, so if you're familiar with HTML, CSS, and JavaScript, you're ready to build applications for any webOS-based device, including the Palm Pre. You'll gain expertise, chapter by chapter, as you build a working mobile application through the course of the book. You'll also learn how to extend existing web apps to work with the new generation of mobile phones.

  • Get a thorough overview of the webOS platform and architecture

  • Understand the critical concepts for application design: what separates webOS from other web and mobile platforms

  • Learn the details of Mojo's development tools and SDK for building and testing mobile applications

  • Examine best practices, important considerations, and guiding principles for developing with webOS and the Mojo framework

  • Table of Contents

    1. Palm® webOS™
    2. Dedication
    3. A Note Regarding Supplemental Files
    4. Foreword
    5. Preface
      1. Mobile Web Challenges
        1. Palm webOS
      2. The Mobile Web Is the Web
      3. About This Book
      4. Conventions Used in This Book
      5. Using Code Examples
      6. How to Contact Us
      7. Safari® Books Online
      8. Acknowledgments
    6. 1. Overview of webOS
      1. Application Model
      2. Application Framework and OS
      3. User Interface
        1. Navigation
        2. Launcher
        3. Card View
        4. Notifications and the Dashboard
        5. User Interface Principles
      4. Mojo Application Framework
        1. Anatomy of a webOS Application
          1. Stages and scenes
          2. Application lifecycle
          3. Events
          4. Storage
        2. UI Widgets
          1. Using widgets
        3. Services
      5. Palm webOS Architecture
        1. Application Environment
        2. Core OS
      6. Software Developer Kit
        1. Development Tools
        2. Mojo Framework and Sample Code
        3. webOSdev
      7. Summary
    7. 2. Application Basics
      1. Getting Started
        1. Creating Your Application
        2. Testing and Debugging
      2. News
        1. News Wireframes
        2. Creating the News Application
        3. Customizing the Launcher Icon and Application ID
        4. Adding the First Scene
          1. The scene view
          2. The scene assistant
          3. Pushing the scene
          4. Styling the scene
        5. Base Styles
          1. Elements
          2. Scene styles
          3. Widget styles
        6. Application Launch Lifecycle
        7. Adding a Second Scene
      3. Controllers
        1. Controllers and Assistants
        2. Scene Stack
      4. Summary
    8. 3. Widgets
      1. All About Widgets
        1. Declaring Widgets
        2. Setting Up a Widget
        3. Updating a Widget’s Data Model
        4. Widget Event Handling
      2. Using Widgets
      3. Buttons and Selectors
        1. Buttons
          1. Adding a button to News
        2. Selectors
          1. Check Box
          2. Toggle Button
          3. Radio Button
          4. List Selector
          5. Slider
      4. Lists
        1. List Widgets
          1. Back to the News: Adding a Story List
          2. Back to the News: Ajax requests
          3. Back to the News: Adding a feed list
        2. More About Lists
          1. Dynamic lists
          2. Formatters and dividers
      5. Text Fields
        1. Adding Text Fields to News
        2. Password Field
        3. Filter Field
        4. Rich Text Edit
      6. Events
        1. Framework Event Types
        2. Listening
        3. stopListening
        4. Using Events with Widgets
      7. Summary
    9. 4. Dialogs and Menus
      1. Dialogs
        1. Error Dialog
        2. Alert Dialog
        3. Custom Dialogs
          1. Back to the News: Adding an Add Feed dialog
      2. Menus
        1. Menu Widgets
          1. Application menu
          2. Back to the News: Adding an Application menu
          3. Back to the News: Adding preferences to News
          4. View menu
          5. Back to the News: Adding View menus
          6. Command menu
          7. Back to the News: Adding Command menus
        2. Submenus
          1. Back to the News: Adding a submenu
      3. Commander Chain
      4. Summary
    10. 5. Advanced Widgets
      1. Indicators
        1. Spinners
          1. Back to the News: Adding a spinner for feed updates
        2. Progress Indicators
          1. Progress Pill
          2. Progress Bar
          3. Progress Slider
      2. Scrollers
        1. Back to the News: Adding a featured feed Scroller
      3. Pickers
        1. Simple Pickers
          1. Date pickers
          2. Time pickers
          3. Integer pickers
          4. Back to the News: Adding an integer picker
        2. File Picker
      4. Advanced Lists
        1. Formatters
        2. Dividers
        3. Filter Lists
          1. Back to the News: Adding a search field
      5. Viewers
        1. WebView
          1. Back to the News: Adding a web view
        2. Other Viewers
          1. Image view
          2. Audio and video objects
      6. Summary
    11. 6. Data
      1. Working with Cookies
        1. Back to the News: Adding a Cookie
      2. Working with the Depot
        1. Back to the News: Adding a Depot
      3. HTML 5 Storage
      4. Ajax
        1. Ajax Request
        2. Ajax Response
        3. More Ajax
          1. Ajax responders
          2. Ajax.Updater and Ajax.PeriodicalUpdater
      5. Summary
    12. 7. Advanced Styles
      1. Typography
        1. Fonts
        2. Truncation
        3. Capitalization
        4. Vertical Alignment
      2. Images
        1. Standard Image
        2. Multistate Image
        3. 9-Tile Image
          1. 3-tile image
          2. Unsupported CSS properties
      3. Touch
        1. Maximize Your Touch Targets
        2. Optimizing Touch Feedback
        3. Passing Touches to the Target
      4. Light and Dark Styles
      5. Summary
    13. 8. Application Services
      1. Using Services
        1. Service Overview
        2. Application Manager
          1. Open
          2. Launch
        3. Cross-App Launch
      2. Core Application Services
        1. Web
          1. Back to the News: Launching the browser
        2. Phone
        3. Camera
        4. Photos
        5. Maps
      3. Palm Synergy Services
        1. Account Manager
        2. Contacts and Calendar
        3. People Picker
        4. Email and Messaging
          1. Back to the News: Sharing stories through email or messaging
      4. Viewers and Players
        1. View File
        2. Audio
        3. Video
      5. Other Applications
      6. Summary
    14. 9. System and Cloud Services
      1. System Services
        1. Accelerometer
          1. Orientation changes
          2. Shake
          3. Raw acceleration
        2. Alarms
        3. Connection Manager
        4. Location Services
          1. Get current position
          2. Tracking
          3. Reverse location
        5. Power Management
        6. System Properties
        7. System Services
        8. System Sounds
      2. Cloud Services
      3. Summary
    15. 10. Background Applications
      1. Stages
        1. Creating New Stages
        2. Using Existing Stages
        3. Working with Stages
      2. Notifications
        1. Banner Notifications
          1. Back to the News: Banner notifications
        2. Minimized Applications
        3. Pop-up Notifications
      3. Dashboards
        1. Back to the News: Adding a Dashboard Stage
        2. Handling Minimize, Maximize, and Tap Events
      4. Advanced Applications
        1. Back to the News: App Assistant
        2. Handling Launch Requests
        3. Sending and Considering Notifications
        4. Back to the News: Creating Secondary Cards
      5. Background Applications
      6. Summary
    16. 11. Localization and Internationalization
      1. Locales
        1. Character Sets and Fonts
        2. Keyboards
      2. Localization
        1. Localized Application Structure
        2. appinfo.json
        3. JavaScript Text Strings
          1. Identifying strings
          2. Extracting strings
          3. Localizing strings
        4. Localizable HTML
          1. Identifying and extracting strings
          2. Localizing strings
      3. Internationalization
        1. Back to the News: Multilingual Formatting
      4. Summary
    17. A. Palm webOS Developer Program
      1. Philosophy
      2. Palm webOS: Open Platform, Open Community
      3. Benefits to the Developer
      4. Resources and Community
      5. What You Should Do
    18. B. Quick Reference—Developer Guide
      1. Widgets
        1. Button
        2. Check Box
        3. Date Picker
        4. Drawer
        5. File Picker
        6. Filter Field
        7. Filter List
        8. Image View
        9. Integer Picker
        10. List
        11. List Selector
        12. Password Field
        13. Progress Bar
        14. Progress Pill
        15. Progress Slider
        16. Radio Button
        17. Rich Text Edit
        18. Scroller
        19. Slider
        20. Spinner
        21. Text Field
        22. Time Picker
        23. Toggle Button
        24. Web View
      2. Dialogs
        1. Mojo.Controller.errorDialog()
        2. Mojo.Controller.SceneController.showAlertDialog()
        3. Mojo.Controller.SceneController.showDialog()
      3. Menus
        1. AppMenu
        2. Command Menu
        3. View Menu
        4. Submenu
      4. Storage
        1. Mojo.Model.Cookie()
        2. Mojo.Depot()
      5. Services
        1. Accounts
          1. Method: listAccounts
          2. Method: createAccount
          3. Method: getAccount
          4. Method: updateAccount
          5. Method: deleteAccount
        2. Alarms
          1. Method: set
          2. Method: clear
        3. Application Manager
          1. Method: open
          2. Method: launch
        4. Audio
          1. Method: launch
        5. Calendar
          1. Method: createCalendar
          2. Method: getCalendar
          3. Method: updateCalendar
          4. Method: deleteCalendar
          5. Method: listCalendars
          6. Method: createEvent
          7. Method: getEvent
          8. Method: updateEvent
          9. Method: deleteEvent
          10. Method: listEvents
          11. Method: startTracking
          12. Method: getChanges
          13. Method: doneWithChanges
        6. Connection Manager
          1. Method: getStatus
        7. Contacts
          1. Method: createContact
          2. Method: getContact
          3. Method: updateContact
          4. Method: deleteContact
          5. Method: listContacts
          6. Method: startTracking
          7. Method: getChanges
          8. Method: doneWithChanges
        8. Email
          1. Method: open
          2. Method: launch
        9. Location Services
          1. Method: getCurrentPosition
          2. Method: startTracking
          3. Method: getReverseLocation
        10. Maps
          1. Method: open
          2. Method: launch
        11. Messaging
          1. Method: launch
        12. Phone
          1. Method: open
          2. Method: launch
        13. Photos
          1. Method: launch
        14. System Properties
          1. Method: getSysProperties
        15. System Service
          1. Method: getSystemTime
        16. System Sounds
          1. Method: playFeedback
        17. Video
          1. Method: launch
      6. Controller APIs
        1. Mojo.Controller.AppController.createStageWithCallback(stageArguments, onCreate, optionalStageType)
        2. Mojo.Controller.AppController.getActiveStageController(stageType)
        3. Mojo.Controller.AppController.getScreenOrientation()
        4. Mojo.Controller.AppController.getStageController(stageName)
        5. Mojo.Controller.AppController.getStageProxy(stageName)
        6. Mojo.Controller.AppController.sendToNotificationChain(notificationData)
        7. Mojo.Controller.AppController.showBanner(bannerParams, launchArguments, category)
        8. Mojo.Controller.SceneController.listen(element, eventType, callback, onCapture)
        9. Mojo.Controller.SceneController.get(elementId)
        10. Mojo.Controller.SceneController.removeRequest(request)
        11. Mojo.Controller.SceneController.serviceRequest(url, options, resubscribe)
        12. Mojo.Controller.SceneController.setupWidget(name, attributes, model)
        13. Mojo.Controller.SceneController.stopListening(element, eventType, callback, onCapture)
        14. Mojo.Controller.StageController.activate()
        15. Mojo.Controller.StageController.activeScene()
        16. Mojo.Controller.StageController.deactivate()
        17. Mojo.Controller.StageController.delegateToSceneAssistant(functionName)
        18. Mojo.Controller.StageController.getScenes()
        19. Mojo.Controller.StageController.getWindowOrientation()
        20. Mojo.Controller.StageController.popScene(returnValue, options)
        21. Mojo.Controller.StageController.popScenesTo(targetScene, returnValue, options)
        22. Mojo.Controller.StageController.pushScene(sceneArguments)
        23. Mojo.Controller.StageController.setWindowOrientation(orientation)
        24. Mojo.Controller.StageController.swapScene(sceneArguments)
        25. Mojo.Controller.StageController.topScene()
    19. C. Quick Reference—Style Guide
      1. Scene Basics
        1. Backdrop
        2. Fixed Header
        3. Page Header
        4. Scrim
        5. Scroll Fades
        6. View/Command Menus
      2. List Basics
        1. Add/Remove Rows
        2. Lists and Rows
        3. Separators
        4. Reordering Rows
        5. Swipe to Delete
        6. Touch Feedback
        7. Touch Feedback with Groups
      3. Containers
        1. Drawers
        2. Labeled Groups
        3. Unlabeled Groups
      4. Dividers
        1. Alphabetical Dividers
        2. Collapsible Dividers
        3. Labeled Dividers
        4. Solid Dividers
      5. Panels
        1. Dashboard Panel
        2. Dialog
        3. Menu Panel
        4. Submenu
      6. Text
        1. Basic Text Styles
        2. Capitalization
        3. Fonts
        4. Truncation
      7. Widgets
        1. Button
        2. Check Box
        3. Date Picker
        4. Integer Picker
        5. Filter Field
        6. List Selector
        7. Progress Pill
        8. Radio Button
        9. Slider
        10. Spinner
        11. Text Field
        12. Time Picker
        13. Toggle Button
    20. D. News Application Source Code
      1. News Application Directory Structure
        1. news/app/assistants/app-assistant.js
        2. news/app/assistants/dashboard-assistant.js
        3. news/app/assistants/feedList-assistant.js
        4. news/app/assistants/preferences-assistant.js
        5. news/app/assistants/storyList-assistant.js
        6. news/app/assistants/storyView-assistant.js
        7. news/app/models/cookies.js
        8. news/app/models/feeds.js
        9. news/app/assistants/views/dashboard/dashboard-scene.html
        10. news/app/assistants/views/dashboard/item-info.html
        11. news/app/assistants/views/feedList/addFeed-dialog.html
        12. news/app/assistants/views/feedList/feedList-scene.html
        13. news/app/assistants/views/feedList/feedListTemplate.html
        14. news/app/assistants/views/feedList/feedRowTemplate.html
        15. news/app/assistants/views/preferences/preferences-scene.html
        16. news/app/assistants/views/storyList/storyList-scene.html
        17. news/app/assistants/views/storyList/storyListTemplate.html
        18. news/app/assistants/views/storyList/storyRowTemplate.html
        19. news/app/assistants/views/storyView/storyView-scene.html
        20. news/appinfo.json
        21. news/framework_config.json
        22. news/index.html
        23. news/resources/es_us/appinfo.json
        24. news/resources/es_us/strings.json
        25. news/resources/es_us/views/feedList/addFeed-dialog.html
        26. news/resources/es_us/views/feedList/feedList-scene.html
        27. news/resources/es_us/views/preferences/preferences-scene.html
        28. news/sources.json
        29. news/stylesheets/News.css
    21. Index
    22. About the Author
    23. Colophon
    24. Copyright