Stages
In Chapter 1, you were introduced to stages:
A stage is similar to a conventional HTML window or browser tab. Applications can have one or more stages, but typically the primary stage will correspond to the application’s card. Other stages might include a dashboard, a pop-up notification, or secondary cards for handling specific activities within the application. Refer to email as an example of a multistage application, where the main card holds the account lists, inbox and displays the email contents, but new emails are composed in a separate card to allow for switching between compose and other email activities. Each card is a separate stage, but still part of a single application.
We haven’t worked much with stages so far, but they are an essential part of the features discussed in this chapter. Each secondary card, dashboard summary, or pop-up notification is a separate window, and each window corresponds to a stage, with a stage controller that manages that window. Recall that each stage controller has a stack of scene controllers, with the topmost scene activated and in view within the stage’s window.
Before we build each feature into the News application, we’ll start with some general information about using stages.
Creating New Stages
All stages are created the same way, with a call to createStageWithCallback()
, an application
controller method, and a callback function, which at a minimum will push
the first scene using the newly created stage controller:
var stageArguments ...
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.