How can Enyo call the system service in webOS?

Source: Internet
Author: User

Enyo1.0 provides five services:

System: "palm: // com. palm. systemservice /"

Telephony: "palm: // com. palm. telephony /"

Database: "luna: // com. palm. db /"

Application: "palm: // com. palm. applicationManager /"

Accounts: "palm: // com. palm. service. accounts /"

By calling these services, we can obtain a lot of information related to the webOS system. Why does the JavaScript in webOS (Enyo is a JS framework) support direct operating system information?

All secrets are in enyo \ 1.0 \ framework \ source \ palm \ services \ bridge \ WebosConnect. js.

At the beginning of the 59 lines of this file, there is the following code:

As you can see, enyo inserts an applet tag in the page. Here the jar package webOSconnect_1_3.jar is added and the com. palm. webos. connect. DeviceConnection class in the package will be called.

This jar package is a component that interacts directly with system data. Without the source code entered in the jar package, we cannot implement it in detail.

The second part: "accessing methods and variables in Java Applet from JavaScript" describes the call process in detail.

I paste the sample code below:

Using mytest.htm"

 
  1. Function accessApplet ()
  2. {SetTimeout ("changeText ('I like JavaScript! ') ", 1000 );
  3. SetTimeout ("changeText ('I like JavaScript and Java! ') ", 2000 );
  4. SetTimeout ("changeText ('I like Java! ') ", 3000 );
  5. SetTimeout ("accessapple()", 4000 );
  6. }
  7. Function changeText (s)
  8. {
  9. Too many Doc ument. testText. setText (s)
  10. // Call the setText method of the Java applet.
  11. // Note that the applet name must be identified by the "applet" flag name attribute
  12. }
  13. // Call accessApplet to load the Applet

"Testtext. java"

 
  1. Import java. applet .*;
  2. ......
  3. Public class Testtext extends Applet
  4. {......
  5. Public void setText (String s) // setText must be declared as "public"
  6. {
  7. Text = s;
  8. Repaint ();
  9. }
  10. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.