JS Service Basics

Version added 07-Mar-2018| Modified 15-Oct-2018

JavaScript services (JS services) on webOS Open Source Edition (OSE) provide a way for apps to work, even when the application is not running. The typical characteristics of a JS service on webOS OSE are as follows:

  • Written in JavaScript and created using Node.js*.

  • Runs in the background.

  • Provides additional access to platform features such as low-level networking, file system access, and binary data processing. These features are normally not available to web apps.

  • Performs tasks for one or more apps.

* Node.js was originally created as a framework for server-side JavaScript applications. Services in webOS OSE are not quite like web application servers (in particular, because they don't stay running all the time), but the basic framework of an asynchronous I/O and network stack makes a lot of sense as an extension of the webOS app environment. You can find out more about Node.js at the Node.js website.

Examples of JS Services

  • Downloading attachments in the background for an email reader.

  • Uploading images to a picture-sharing website from an app.

  • Performing a long-running computation or file operation.

Differentiation of JS Services

JS services can be classified as follows:

 

Built-in JS Service

External (side-loading) JS Service

Distribution

Must be included in the webOS image. 

Must be installed on the webOS target device.

Packaging

Can be a standalone service.

Must be packaged within a web app.

Configuration files

Created manually by developer.

Created automatically by SDK CLI utilities and webOS install service.

Build files

Created manually by developer.

No build files required.

Target users

Platform developers.

3rd-party developers.

Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.