Quick ReferenceDeveloper Guide - Palm webOS
by Mitch AllenThroughout the book, you’ve seen sample code and examples of widgets and services. In this section, those interfaces are compiled in reference form to help you as you are coding or if you just want to look something up.
This excerpt is from Palm webOS. 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 offers you a complete tutorial on the design principles, architecture, UI, tools, and services necessary to develop webOS applications. If you're familiar with HTML, CSS, and Javascript, you're ready to build applications for webOS-based devices, including the Palm Pre.
This is not a comprehensive list of all Mojo APIs; for that you should refer to the SDK site. There you will find the APIs mentioned in this book, including:
Widgets
Dialogs
Menus
Storage
Services
Controller APIs
This section includes all of the Mojo widgets. Each widget section includes a brief description repeating some of the information from Chapters 3, 4, and 5, followed by an enumeration of the widget’s attribute and model properties, relevant events, and public methods.
Buttons are the most basic UI element, bounding an action to a region. When a button is pushed, it can change state but gracefully returns to the previous state, like a doorbell.
Events |
|---|
Mojo.Event.tap |
Methods | |
|---|---|
activate() | For an activity button, start the spinner |
deactivate() | For an activity button, stop the spinner |
A Check Box widget is used to control and indicate a binary state value in one element.
Model properties | Type | Description |
|---|---|---|
value | Boolean | Current value of widget |
disabled | Boolean | Default property that when true, disables the widget |
Events |
|---|
Mojo.Event.propertyChange |
The date picker allows selection of month, day, and year values.
Model properties | Type | Description |
|---|---|---|
date | Date | Date object set to the widget value |
Events |
|---|
| None |
Drawers are container widgets that can be open, allowing child content to be displayed normally, or closed, keeping it out of view.
Model properties | Type | Description |
|---|---|---|
open | Boolean | Current state of the widget; set to true when open |
Events |
|---|
Mojo.Event.propertyChange |
Methods | |
|---|---|
setOpenState(open) | Sets the open state to open or closed |
getOpenState() | Returns current value of open state |
toggleState() | Change the drawer’s open state to the opposite of what it is now |
Mojo.FilePicker.pickFile (params,
stageController) |
The File Picker presents a file browser that lets the user navigate the directory structure and optionally select a file. The File Picker lets users view and select files from the media partition, and allows filtering by file type (e.g., file, image, audio, or video).
Events |
|---|
None |
The Filter Field can be applied to any case where you want to process the field contents and update on-screen elements based on the entered string.
Attribute properties | Type | Description |
|---|---|---|
delay | Integer | Delay between key strokes for a filter event, in milliseconds |
disabledProperty | String | Name of model property for disabled state |
Model properties | Type | Description |
|---|---|---|
disabled | Boolean | Default property that, when true, disables the widget |
Events |
|---|
Mojo.Event.filter |
Methods | |
|---|---|
open() | Open the widget |
close() | Close the widget |
setCount(integer) | Set the number to be shown in the results bubble in the Filter Field |
The Filter List combines a Filter Field and a List. It is intended to display a variable length list of objects, built by a special callback function that filters the list based on the contents of the filter field.
Model properties | Type | Description |
|---|---|---|
disabled | Boolean | Default property that, when true, disables the widget |
Events |
|---|
Mojo.Event.listChange Mojo.Event.listTap Mojo.Event.listAdd Mojo.Event.listDelete Mojo.Event.listReorder Mojo.Event.filter |
You can use an ImageView for
displaying single images, but it is intended as a scrolling viewer,
flicking left and right through a series of images.
Attribute properties | Type | Description |
|---|---|---|
highResolutionLoad | Integer | Time to wait before switching photo to high res |
noExtractFS | Boolean | Flag to prevent looking up a high res version |
fslimitZoom | Boolean | Flag to prevent or limit zooming |
Model properties | Type | Description |
|---|---|---|
onLeftFunction | Function | Called after a left scroll and transition |
onRightFunction | Function | Called after a right scroll and transition |
Events |
|---|
Mojo.Event.imageViewChanged |
The Integer Picker offers a selection between minimum and maximum integer values, both of which are specified as properties.
Model properties | Type | Description |
|---|---|---|
value | Integer | Current value of the widget |
Events |
|---|
Mojo.Event.propertyChange |
List is the most common and possibly the most powerful Mojo widget. Objects are rendered into list items using provided HTML templates, and may be variable height and/or include other widgets.
Model properties | Type | Description |
|---|---|---|
items | Array | An array of objects to
display in the list; required unless |
Events |
|---|
Mojo.Event.listChange Mojo.Event.listTap Mojo.Event.listAdd Mojo.Event.listDelete Mojo.Event.listReorder |
The List Selector enables the selection of one of many options, presented in a pop-up list in which there is no practical limit to the number of options presented. This is similar to the Submenu widget behavior.
Events |
|---|
Mojo.Event.propertyChange |
A text field used for passwords or some other type of confidential information, the Password Field provides many of the Text Field features, but masks the display. Any entered text is displayed as a bullet or “•” character.
Model properties | Type | Description |
|---|---|---|
value | Boolean | Plain-text value of the widget |
Events |
|---|
Mojo.Event.propertyChange |
Progress Bar displays a narrow horizontal bar with an incremental internal bar to show progress. Use a Progress Bar or Pill to show download progress, when loading from a database, or anytime you initiate a long-running operation and have a sense of the duration.
Model properties | Type | Description |
|---|---|---|
value | Integer | Value of the widget |
title | String | Dynamic title to show on bar |
image | String | File path relative to application folder for dynamic image to show on bar |
Events |
|---|
Mojo.Event.progressComplete |
Methods | |
|---|---|
reset() | Reset progress to 0 |
cancelProgress() | Stop the progress and freeze bar display in current state |
Progress Pill displays a broad horizontal bar with an incremental pill to show progress. Use a Progress Bar or Pill to show download progress, when loading from a database, or anytime you initiate a long-running operation and have a sense of the duration.
Model properties | Type | Description |
|---|---|---|
value | Integer | Value of the widget |
title | String | Dynamic title to show on bar |
image | String | File path relative to application folder for dynamic image to show on bar |
Events |
|---|
Mojo.Event.progressIconTap Mojo.Event.progressComplete |
Methods | |
|---|---|
reset() | Reset progress to 0 |
cancelProgress() | Stop the progress and freeze bar display in current state |
For media or other applications in which you want to show progress as part of a tracking slider, the Progress Slider is an ideal choice. Combining the Slider widget with the Progress Pill, the behavior is fully integrated, but not all of the configuration options are represented.
Model properties | Type | Description |
|---|---|---|
value | Integer | Value of the widget |
Events |
|---|
Mojo.Event.propertyChange Mojo.Event.progressComplete |
Methods | |
|---|---|
reset() | Reset progress to 0 |
The Radio Button presents each button as a labeled selection option in a horizontal array, where only one option can be selected at a time.
Model properties | Type | Description |
|---|---|---|
value | Boolean | Current value of widget |
disabled | Boolean | Default property that, when true, disables the widget |
Events |
|---|
Mojo.Event.propertyChange |
There is a simple Rich Text Edit widget that behaves similar to a multi-line
text field, but in addition supports applying Bold, Italic, and
Underline styles to arbitrary runs of
text within the field. To enable the styling, set the
Application menu’s RichTextEditItems property to
true.
The Scroller widget provides the scrolling behavior in Mojo. Scrollers can be applied to any div content and set to one of six scrolling modes.
Attribute properties | Type | Description |
|---|---|---|
| String | Scrolling mode; one of
|
Model properties | Type | Description |
|---|---|---|
snapElements | Array | Array of DOM elements used as snap points for horizontal or vertical scrolling |
Events |
|---|
Mojo.Event.propertyChange |
The Slider presents a range of selection options in the form of a horizontal slider with a control knob that can be dragged to the desired location.
Model properties | Type | Description |
|---|---|---|
value | Integer | Value of the widget |
Events |
|---|
Mojo.Event.propertyChange |
Use a Spinner to show that an activity is taking place. The framework uses a Spinner as part of any activity button, and you’ll see it used in the core applications. There are two sizes: the large Spinner is 128 × 128 pixels, and the small Spinner is 32 × 32.
Model properties | Type | Description |
|---|---|---|
spinning | Boolean | Spinner state; set to true if spinning |
Events |
|---|
Mojo.Event.propertyChange |
Methods | |
|---|---|
start() | Start the spinner |
stop() | Stop the spinner |
toggle() | Change the spinner from start to stop or from stop to start |
The basic text widget that supports all general text requirements: single or multi-line text entry, with common styles for labels, titles, headings, body text, line items, and item details. The editing tools include basic entry and deletion, symbol and alternate character sets, cursor movement, selection, cut/copy/paste, and auto text correction.
Model properties | Type | Description |
|---|---|---|
value | Boolean | Value of the widget |
disabled | Boolean | Default property that when true, disables the widget |
Events |
|---|
Mojo.Event.propertyChange |
The Time Picker enables selection of hours, minutes, and either A.M. or P.M. for time selection. The picker will suppress the A.M./P.M. capsule if the 24-hour time format is selected in the user preferences or by the locale.
Model properties | Type | Description |
|---|---|---|
time | Date | Date object set to the widget value |
Events |
|---|
Mojo.Event.propertyChange |
The Toggle Button is another widget for displaying and controlling a binary state value. As with the Check Box, the Toggle Button will switch between two states each time it is tapped.
Model properties | Type | Description |
|---|---|---|
value | Boolean | Current value of widget |
disabled | Boolean | Default property that, when true, disables the widget |
Events |
|---|
Mojo.Event.propertyChange |
To embed a contained web object, declare and instantiate a WebView widget. You can use it render local
markup or to load an external URL; as long as you can define the source
as a reachable URL, you can use a WebView to render that resource.
Model properties | Type | Description |
|---|---|---|
None |
This section includes the three Mojo dialog APIs:
Error dialog
Alert dialog
Custom dialog
Each entry includes a brief description, repeating some of the information from Chapter 4, Dialogs and Menus, followed by an enumeration of the arguments. Dialogs are accessed through a direct API so the format for this entry will be structured as an API entry.
This API is used to post error messages in a modal dialog box with a fixed title of “Error,” a customizable message, and a confirmation button. The Error dialog must be used only with errors, since you can’t change the title.
You can display a short message using an Alert dialog, with one or more HTML buttons presenting the selection options. This is the best option if you have either a nonerror message for the user or want to present options in the form of button selections.
The showDialog function can
display any type of content to the user in the form of a modal dialog
box. You can put anything into a dialog box that you’d put into a scene,
meaning almost any web content or Mojo UI content.
This section summarizes the four menu types:
Application menu
Command menu
View menu
Submenu
The three menu types are structured like the widgets in the previous section. Each entry includes a brief description, repeating some of the information from Chapter 4, Dialogs and Menus, followed by an enumeration of the widget’s attribute and model properties, as well as relevant events. Unlike the other menu types, Submenu is accessed through a direct API, so the format for this entry will be structured as an API entry.
The Application menu appears in the upper-left corner of the screen when the user taps the left side of the status bar. It includes some system-defined and some application-defined actions, and is intended to have an application-wide scope for the most part.
Events |
|---|
Mojo.Event.command Mojo.Event.commandEnable |
The Command menu items are presented at the bottom of the screen. Items include variable-sized buttons that can be combined into groups, and in a horizontal layout from left-to-right.
Events |
|---|
Mojo.Event.command Mojo.Event.commandEnable |
The View menu presents items as variable-sized buttons, either singly or in groups across the top of the scene. The items are rendered in a horizontal sequence starting from the left of the screen to the right.
Events |
|---|
Mojo.Event.command Mojo.Event.commandEnable |
Mojo.Controller.SceneController.popupSubmenu() |
Pop-up submenus can offer a transient list of choices to the user, typically off of another menu entry or from a DOM element in the scene.
This section describes the Cookie and Depot objects and methods. Each section includes a brief description, repeating some of the information from Chapter 6, Data, followed by an enumeration of each object’s methods with their arguments and return values. Both storage objects are accessed through a direct API, so the format for this entry will be structured as an API entry.
If you’d like more detailed information on the HTML 5 Database object, refer to the specification at http://dev.w3.org/html5/webstorage/#databases.
Mojo cookies are technically related to browser cookies, but with an object interface to simplify use by webOS applications. Mojo cookies typically store small amounts of data that will be used to preserve application state and related information, such as preference settings.
Calling the constructor will open the named cookie if it already exists, or if it doesn’t exist, will create it.
Constructor |
|---|
new Mojo.Model.Cookie(cookieName, optionalDocument) |
The Depot object is a wrapper on the HTML 5 APIs for simple object storage and retrieval. You can store up to 1 MB of data in a depot by default. Mojo provides by a few simple functions that wrap the HTML 5 APIs to create, read, update, or delete a database.
Calling the constructor will open the named depot if it already exists, or if it doesn’t exist, will create it.
Constructor |
|---|
new Mojo.Depot(options, onSuccess, onFailure) |
This section describes the available application, device, and cloud service methods. Each service is briefly described, repeating some of the information from Chapters 8 and 9, with a listing of the service’s available methods, arguments, and responses.
All services are accessed through:
Mojo.Service.Request(serviceName, {method:methodName,
parameters:{}, onSuccess:{}, onFailure:{}})Each service entry includes:
The
serviceNamein the form of a string such as'palm://com.palm.name'A description of each method, with the
methodNameandparameterspropertiesThe contents of the
responseobject, which is provided as an argument in the callbacks to either theonSuccessoronFailurefunctions
palm://com.palm.accounts/crud |
The Accounts service provides an interface for interacting with the accounts system. To use the Synergy applications, you must provide an account ID as a parameter; this service provides access to those IDs.
Many of the methods will use some common objects.
Lists accounts created by this application.
Parameters | Type | Description |
|---|---|---|
None |
Parameters | Type | Description |
|---|---|---|
account | Object | Account object specifying account data |
Gets the details of an account.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use accessing the account or for services that are based on the account |
Updates an account with revised data type, icons, or a change to read/write permissions.
Deletes account data for one or more data types.
palm://com.palm.power/timeout |
The Alarm service is based on the device’s real-time clock (RTC). Alarms are intended to wake applications while minimized, maximized, or to drive polling for Dashboard applications.
Sets an alarm to wake up the application.
Clears a previously set alarm.
Parameters | Type | Description |
|---|---|---|
key | String | The key provided in the method call |
palm://com.palm.applicationManager |
The Application Manager service provides functions related to finding and launching applications. Applications launched through the Application Manager will open and maximize a new window for the targeted application while minimizing the current application window. This is the general case of specific application services. Currently supported are:
Audio
Browser
Email
Maps
Messaging
Phone
Photos
Video
For details on calling individual services, refer to the specific service in this section.
The Application Manager will use the content type to find the appropriate application to use for that content. Refer to Tables B.1, B.2, and B.3 for the supported content types.
Response | Type | Description |
|---|---|---|
None |
Table B.1. Supported file types
Extension | Mime type |
|---|---|
htm | text/html |
html | text/html |
application/pdf | |
txt | application/txt |
doc | application/doc |
doc | application/msword |
xls | appId”:"com.palm.app.docviewer |
xls | appId”:"com.palm.app.docviewer |
xls | application/vnd.ms-excel |
xls | application/x-excel |
xls | application/x-msexcel |
ppt | application/ppt |
ppt | application/mspowerpoint |
ppt | application/powerpoint |
ppt | application/vnd.ms-powerpoint |
ppt | application/x-mspowerpoint |
Table B.2. Supported video formats
Extension | Mime type |
|---|---|
mp4 | video/mp4-generic |
mp4 | video/quicktime |
mp4 | video/mp4 |
mp4 | video/mpeg4 |
m4v | video/mp4-generic |
m4v | video/quicktime |
m4v | video/mp4 |
m4v | video/mpeg4 |
3gp | video/3gp |
3gpp | video/3gp |
3g2 | video/3gpp |
3gpp2 | video/3gpp |
sdp | application/sdp |
Table B.3. Supported audio formats
Extension | Mime type |
|---|---|
3gp | audio/3gpp |
3gpp | audio/3gpp |
3ga | audio/3gpp |
3gp | audio/3ga |
3gpp | audio/3ga |
3ga | audio/3ga |
3g2 | audio/3gpp2 |
3gp2 | audio/3gpp2 |
sdp | audio/amr |
amr | audio/x-amr |
mp3 | audio/mpa |
mp3 | audio/mp3 |
mp3 | audio/x-mp3 |
mp3 | audio/x-mpg |
mp3 | audio/mpeg |
mp3 | audio/mpeg3 |
mp3 | audio/mpg3 |
mp3 | audio/mpg |
mp4 | audio/mp4 |
m4a | audio/mp4 |
m4a | audio/m4a |
aac | audio/aac |
aac | audio/x-aac |
aac | audio/mpeg |
aac | audio/mp4a-latm |
wav | audio/wav |
pls | audio/x-scpls |
m3u | audio/mpegurl |
m3u | audio/x-mpegurl |
palm://com.palm.applicationManager |
The Audio application can be launched through the Application Manager service.
palm://com.palm.calendar/crud |
The Calendar API provides programmatic access to the Calendar application. It allows you to create, read, update, delete, and list calendars, events, and attendees. To use this API you must have an account created via the Accounts API. An account has many calendars, a calendar has many events, and an event has many attendees.
Many of the APIs will use the calendar or event objects as input or output
argument.
Calendar | ||
|---|---|---|
Properties | Type | Description |
calendarId | String | Immutable unique identifier for this calendar |
name | String | Display name for this calendar |
externalId | String | External ID for this calendar |
Note
On methods that accept a calendarId as an input argument (getCalendar, updateCalendar, and deleteCalendar), you can alternately provide
an externalId and an accountId.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use in the Synergy applications |
calendar | Object | Specify the |
Parameters | Type | Description |
|---|---|---|
calendarId | String | Immutable unique identifier for this calendar |
Parameters | Type | Description |
|---|---|---|
calendar | Object | Specify the |
Lists all calendars created by the calling application; you will see only the calendars that you have created.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use in the Synergy applications |
Adds the provided event to the named calendar.
Retrieves the details of the named event.
Parameters | Type | Description |
|---|---|---|
eventId | String | Immutable unique identifier for this event |
Updates the event details of the named event.
Lists all events created by the calling application; you will only see events in calendars that you have created.
Enables change tracking for an account. After this is called, all
user-initiated changes to records belonging to this account will be
returned by getChanges. Change
tracking is incremental, and changes are forgotten each time doneWithChanges is called.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use in the Synergy applications |
trackerId | String | A client-chosen handle if multiple independent change trackers are needed per account |
Gets a list of calendar and event IDs for records in an account that
have been changed or deleted by the user since the last time doneWithChanges was called.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use in the Synergy applications |
trackerId | String | A client-chosen handle if multiple independent change trackers are needed per account |
Forgets all changes for an account. Future calls to getChanges will return only changes from
this point forward.
palm://com.palm.connectionmanager |
Use the Connection Manager’s getStatus method to get updates on the device
connection status.
Gets connections status and optionally subscribes to connection notifications.
Parameters | Type | Description |
|---|---|---|
subscribe | Boolean | Set to true for subscriptions, default is false |
palm://com.palm.contacts/crud |
The Contacts API provides programmatic access to the Contacts application. It allows you to create, read, update, delete, and list contacts entries. To use this API you must have an account created via the Accounts API.
Many of the APIs will use the contacts or contactslice objects as input or output
arguments.
Note
On methods that accept an id
as an input argument (get, update, and delete), you can alternately provide an
externalId and an accountId.
Adds the provided record to contacts.
Retrieves the details of the named contact.
Parameters | Type | Description |
|---|---|---|
id | String | Immutable unique identifier for this contact |
Updates the event details of the named contact.
Response | Type | Description |
|---|---|---|
errorCode | Integer | If |
errorText | String | An error message; only
provided with |
Lists all contacts created by the calling application; you will see only Contact records that you have created.
Enables change tracking for an account. After this is called, all
user-initiated changes to records belonging to this account will be
returned by getChanges. Change
tracking is incremental, and changes are forgotten each time doneWithChanges is called.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use in the Synergy applications |
trackerId | String | A client-chosen handle if multiple independent change trackers are needed per account |
Gets a list of contact IDs for records in an account that have been
changed or deleted by the user since the last time doneWithChanges was called.
Parameters | Type | Description |
|---|---|---|
accountId | String | The account reference for use in the Synergy applications |
trackerId | String | A client-chosen handle if multiple independent change trackers are needed per account |
Forgets all changes for an account. Future calls to getChanges will only return changes from
this point forward.
palm://com.palm.applicationManager |
The Email application can be launched through the Application Manager service.
Launches the Email application to the compose scene, which will be addressed with the provided email address.
Launches the Email application to the compose scene.
Response | Type | Description |
|---|---|---|
None |
palm://com.palm.location |
Palm webOS provides basic location services to get single or multiple location fixes.
You can get the current position sourced from the built in GPS, or through Cell ID or WiFi ID, depending on what’s available.
Requests a continuous GPS fix by invoking the onSuccess callback with a new location
object every time the service determines that the position of the
device has changed. In case of error, the service will call the
callback with error code set to some value greater than 0.
Parameters | Type | Description |
|---|---|---|
subscribe | Boolean | Set to true for subscriptions, default is false |
Requests a location for the given latitude and longitude.
Parameters | Type | Description |
|---|---|---|
latitude | Double | The latitude of the location in degrees |
longitude | Double | The longitude of the location in degrees |
palm://com.palm.applicationManager |
The Maps application can be launched through the Application Manager service.
Launches the Maps application to the map scene, which will be loaded from the results of a query if provided.
Launches the Maps application to the map view scene.
Response | Type | Description |
|---|---|---|
None |
palm://com.palm.applicationManager |
The Messaging application can be launched through the Application Manager service.
Launches the Messaging application to the chat scene.
Response | Type | Description |
|---|---|---|
None |
palm://com.palm.applicationManager |
The Phone application can be launched through the Application Manager service.
palm://com.palm.applicationManager |
The Photos application can be launched through the Application Manager service.
palm://com.palm.preferences/systemProperties |
Applications can request a named system property, currently limited to a unique device ID.
palm://com.palm.systemservice/time |
The system is designed to expose a set of services allowing applications to access some general system settings.
Requests the system time, and if the subscribe property is true, it will receive notifications when the timezone changes and/or the system time changes by a significant amount (currently five minutes).
Parameters | Type | Description |
|---|---|---|
subscribe | Boolean | Set to true for subscriptions, default is false |
palm://com.palm.audio/systemsounds |
The System Sounds service is used to play audio feedback in response to user interaction, with low latency.
Plays a system sound using the feedback stream class. Intended for UI feedback such as UI button clicks, keypad clicks, and similar sounds. The available sound names are enumerated in Table B.4, “System sounds”.
Parameters | Type | Description |
|---|---|---|
name | String | Set to the name of the sound to play (see Table B.4, “System sounds” for a complete list of sound names) |
Table B.4. System sounds
Names | ||
|---|---|---|
appclose back_01 default_425hz delete_01 discardingapp_01 down2 dtmf_0 dtmf_1 dtmf_2 dtmf_3 dtmf_4 dtmf_5 dtmf_6 dtmf_7 dtmf_8 dtmf_9 | browser_01 card_01 card_02 card_03 card_04 card_05 dtmf_asterisk dtmf_pound error_01 error_02 error_03 focusing launch_01 launch_02 launch_03 pagebacwards | pageforward_01 shuffle_02 shuffle_03 shuffle_04 shuffle_05 shuffle_06 shuffle_07 shuffle_08 shuffling_01 shutter switchingapps_01 switchingapps_02 switchingapps_03 tones_3beeps_otasp_done unassigned up2 |
palm://com.palm.applicationManager |
The Video application can be launched through the Application Manager service.
Launches the Video application to play or stream the file located at the target URI, downloading it first if not already on the device. If a URI is not specified, it will launch the video player to its normal starting scene.
Response | Type | Description |
|---|---|---|
This section includes the application, stage, and scene controller methods used in the book. These are just a subset of the APIs available; refer to the Palm SDK for a complete list of the available APIs.
Each entry includes a very brief description, followed by an enumeration of the arguments used in the method call.
Method to create a new stage and be called back when the stage is loaded.
Returns | Type | Description |
|---|---|---|
None |
Function to get a controller or proxy object for a stage. Returns the stage controller if
available, but if the stage is still in the process of being created, a
proxy object will be returned instead. This proxy implements delegateToSceneAssistant(), and will delegate
the calls as expected when the stage is available.
Sends the passed-in notification data to everyone in the commander stack of the focused
window (usually the scene assistant, stage assistant, and application
assistant), calling considerForNotification(), if present, on
each.
Shows the message text from the bannerParams in the
banner area. The launchArguments will be used to launch or
relaunch the application if the banner is touched.
Returns | Type | Description |
|---|---|---|
None |
Wrapper around Mojo.Event.listen that
additionally will call get() on the
element parameter if it is a string, converting it to a DOM node.
Returns | Type | Description |
|---|---|---|
| None |
If the elementId is a string,
calls document.getElementById() with
that string and returns the result. Otherwise, it returns elementId.
Removes a request from the scene’s list of requests to manage; once a scene is popped this will no longer clear the request.
Creates a Palm service request that will be automatically cancelled when
the scene is popped. The parameters are passed directly to new Mojo.Service.Request().
Returns | Type | Description |
|---|---|---|
request | Object | A request object, important for requests that persist beyond scene’s life or to be able to remove the request |
Registers the given attributes and model to be used with the widget of the given name. Called by scene assistants in their setup methods.
Wrapper around Mojo.Event.stopListening that additionally
will call get() on the element
parameter if it is a string, converting it to a DOM node.
Returns | Type | Description |
|---|---|---|
None |
Activates this stage, similar to window.focus(). Causes card windows to be
maximized.
Arguments | Type | Description |
|---|---|---|
None |
Returns | Type | Description |
|---|---|---|
None |
Returns the currently active scene from this stage, if any. If no scenes are active, it returns undefined.
Deactivates this stage. Causes card windows to be minimized.
Arguments | Type | Description |
|---|---|---|
None |
Returns | Type | Description |
|---|---|---|
None |
Use to call a method on the assistant of the current scene of this stage. The
first parameter is the name of the property that contains the function
to call. The remaining parameters are passed to that function. The
this keyword is bound to the scene assistant for this
call; any additional arguments will be passed to the scene assistant’s
method.
Removes a scene from the scene stack, passing the return value to the
newly revealed scene’s activate
method. Note that this is an asynchronous operation. Any additional
arguments are also passed to the new scene.
Removes scenes from the scene stack until the target scene is reached, or
no scenes remain on the stack. targetScene may be either the SceneController for the desired scene, the
scene DOM ID, or the scene name. If targetScene is undefined, all scenes will be
popped. Intermediate popped scenes are not reactivated, nor is there any
visual transition to signify their removal from the stack. This is an
asynchronous operation.
Pushes a new scene; the Scene Lifecycle initial setup includes this function. This is an asynchronous operation.
If you enjoyed this excerpt, buy a copy of Palm webOS.
