Unlock instant, AI-driven research and patent intelligence for your innovation.

Method for JavaScript object expansion

A java layer and object technology, applied in the web application field of the Android system, can solve the problems of high maintenance cost and poor code versatility, and achieve the effect of good versatility and improved development efficiency.

Active Publication Date: 2016-07-06
INST OF ACOUSTICS CHINESE ACAD OF SCI +1
View PDF4 Cites 10 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The purpose of the present invention is to overcome the defects of poor code versatility and high maintenance cost in the current method for extending JavaScript objects in the Android system browser kernel, and provides a method for extending JavaScript objects

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for JavaScript object expansion
  • Method for JavaScript object expansion
  • Method for JavaScript object expansion

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0028] In the application development framework of the Android system, a WebView component is provided for developers. WebView is a browser component based on the WebKit kernel. WebKit is a browser kernel developed in C++. It is used as a third-party library in the Android system. WebKit is a layout and rendering engine for web pages, rendering HTML / CSS / JavaScript scripts into visible pages , WebView is the Java layer view class of WebKit. Through the WebView component, you can implement the Web browsing function in the Android application, process the network request, and display the page. WebView provides the addJavascriptInterface interface, which can register Java objects in WebView, and call Java objects through JavaScript objects in the page. But if you want JavaScript to call the interface of C++ components, you need to complete the mutual calling of Java and C++.

[0029] In the Android system, mutual calls between Java and C++ can be realized. AndroidNDK (NativeDev...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention relates to a method for JavaScript object expansion. The method comprises steps that a JavaScript object is called by a page, a call request is transmitted through a customization object of a JavaScript level, an object of a Java level and a JNI object to an object of a C++ level; a local assembly is called by the object of the C++ level according to the call request to carry out asynchronous processing; after processing, a callback message is returned; the content of the callback message is packaged by the object of the C++ level into a JSON format, and the packaged content is sent through a socket client; at the Java level, the message is received by a socket service end, and the message is placed in a message queue in a presently-displayed WebView; the message is acquired by the customization object of the JavaScript level from the message queue at fixed time; an event of the JavaScript object is triggered, and the message is notified to the page in a mode of the event.

Description

technical field [0001] The invention relates to the field of Web applications of the Android system, in particular to a method for extending JavaScript objects. Background technique [0002] With the rise of HTML5, the functions of browsers are gradually enriched, and some localized functions can be realized, including local storage, video playback, etc. Web applications based on browsers have the advantages of low development threshold and easy transplantation. In order to enrich the functions of web applications, when building web applications, an important issue is to extend the interface of local components (usually C / C++ dynamic library) to JavaScript (script, abbreviated as JS) interface for web application transfer. [0003] In the prior art, if a local component is to be extended to a JavaScript interface, a DOM (DocumentObjectModel, Document Object Model) module needs to be extended into a DOM object in the browser kernel, and then the extended DOM object is regis...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): H04L29/08
Inventor 胡琳琳王硕郭志川
Owner INST OF ACOUSTICS CHINESE ACAD OF SCI