External JS services must be packaged in a web app. Therefore, before creating a JS service, make sure you have a web app to package with the external JS service. If such a web app is not available, create a web app as described in Creating Web Apps.
Creating JS Services
JS services can be created and deployed using CLI commands that are provided by webOS OSE SDK. This topic describes the steps to create an external JS service. For detailed information on the commands, see Command-Line Interface.
Once you generate the service, JS service directory should be configured as below.
APP_DIR: Directory of the web app.
SERVICE_DIR: Directory of the service. This directory will include sub-directories of the services that are included in the web app.
Developing an external JS service requires the following steps:
Note If the JS service uses methods of external services, you must add the group information of the external methods to the requiredPermission field in appinfo.json of the web app used for packaging the JS service. See Configuring the Web App for details.
Step 5: Install the JS Service
The JS service must be installed along with the web app.
About launching the JS service Because external JS services are installed as a dynamic service type, the service becomes active only when another application or service use the service by calling its method. If its method has been called as subscription, the service remains active without exiting. If the service is not used, it exits after 5 seconds. For more information on the 5-second timeout, see FAQ.
Debugging JS Services
To launch the Node inspector on a webOS OSE device, you must execute the ares-inspect command while the JS service is running. For detailed information on the command, see ares-inspect.
This loads the Node Inspector in your default browser as shown below:
Note Node Inspector works only in Blink-based web browsers such as Chrome and Opera. If another browser (e.g., Safari or Internet Explorer) is set as your default web browser, you must re-open the inspector page in a Blink-based web browser.