System Services

This section describes each of the system services. Very few of the services apply to the News application, so most of the code samples in this section are simple ones to illustrate the service calls and handlers.

The system services are accessed through Mojo.Service.Request(), or the equivalent scene controller method this.controller.serviceRequest():

Mojo.Service.Request("palm://serviceName", options, requestOptions);

The arguments are described in Chapter 8, but briefly:


Is a URI-formatted string that uniquely specifies the service name.


Includes the designated method, parameters, and callback functions.


Is either set to true, requesting automatic subscription renewal on error, or an object with a resubscribe property and/or a useNativeParser property.


Be careful to prevent garbage collection of your service requests. Recall from Chapter 8 that requests made with this.controller.serviceRequest() are garbage-collected and destroyed when the scene is popped. You should use Mojo.Service.Request() to save the request object and handle termination of the request yourself to prevent garbage collection.

Service requests do not complete when you make the call; they are all asynchronous. If it’s possible that the life of your request will outlast the life of the assistant when the call is made, you must use Mojo.Service.Request().

Get Palm webOS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.