Advanced Applications

We’ve pushed the simple model of single application stage far enough to incorporate services, notifications, and even dashboard stages, but we need to move to a more advanced model to access the rest of the features. An advanced application will have some or all of these characteristics:

  • Use an application assistant as the main application entry point and for handling application initialization and coordination.

  • Create a primary card stage when launched.

  • Handle relaunch or remote launch requests through a defined handleLaunch method.

  • Post banner notifications and maintain a dashboard panel for events while not in focus or in the background.

  • Schedule wakeup requests through the Alarm service and handle the alarm callbacks in the background.

If you aren’t clear on the application lifecycle or the role of the application assistant, you may want to review Chapter 2 before reading the rest of this chapter.

Back to the News: App Assistant

This chapter began with a list of guidelines for developing multistage applications. News needs to be cleaned up to conform to those guidelines, so before creating the app assistant, we’ll make these changes to News:

  1. Remove use of the global window object; change window.setInterval() to this.controller.window.setInterval().

  2. Use the local controller’s stageController methods; instead of Mojo.Controller.stageController methods for pushScene, we’ll use swapScene, as in this example in storyView-assistant.js in the handleCommand method: ...

Get Palm webOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.