3rd-party Services

From WebOS101

Jump to: navigation, search

Contents

Introduction

webOS 2.x and 3.x allow developers to write JavaScript services, which are accessed the same as built-in services. JavaScript services are packaged along with an application, so to find out if a 3rd-party service is installed, you have to know what application it's packaged with.

Sample Calling Code

3rd-party services are called in the same way as built-in services:

var request = new Mojo.Service.Request("palm://com.example.app.service", {
method: 'mycommand',
parameters: {
foo: 42,
bar: false
},
onSuccess: function(){ Mojo.Log.info("mycommand success"); },
onFailure: function(){ Mojo.Log.info("mycommand failure"); }
 
});

or

PalmCall.call("palm://com.example.app.service/", "mycommand", {foo: 42, bar: false});

or

{name:"serviceName",kind:"PalmService",service:"palm://com.example.app.service/"}
 
this.$.serviceName.call(
{foo:42},
{method:"mycommand",onSuccess:"successFunc",onFailure:"failureFunc"}
);

Documenting Services

Documentation should be similar to the HP/Palm documentation on built-in services (https://developer.palm.com/content/api/reference/services.html), and should include

  • service id
  • for each command, include
    • command name
    • command description
    • parameters to pass
    • return values

Known 3rd-party Services

[none so far!]

Personal tools