Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Native object calling method for JS, and storage medium

A native and object technology, applied in the field of application development, it can solve problems such as poor user experience and interface freezes, shortening the interface request time, optimizing user experience, and solving interface freezes.

Active Publication Date: 2018-09-28
FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF11 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Interface requests take time. If you add several different interfaces, the data request time will be longer, the interface will freeze, and the user experience will be bad.

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
  • Native object calling method for JS, and storage medium
  • Native object calling method for JS, and storage medium
  • Native object calling method for JS, and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0065] Please refer to Figure 2-Figure 11 , this embodiment provides a method for invoking a native object by JS based on the React-Native framework. This embodiment expands on the basis of creating a native module pool corresponding to the native module on the JS layer of the prior art, and can realize calling the instance through the JS layer, and can directly operate on the native instance, and then implement the instance pool Multiple native instances of the system are operated in parallel, that is, multiple interfaces are operated in parallel, thereby shortening the data request time, solving the interface freeze problem, and optimizing user experience.

[0066] The method of this embodiment may include:

[0067] 1. Preparatory stage:

[0068] Create a native class pool, a native instance pool, and a native intermediary module in the native layer, map them to the JS layer, and obtain a corresponding JS class pool, a JS instance pool, and JS intermediary module.

[006...

Embodiment 2

[0124] This embodiment corresponds to Embodiment 1, and provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the JS call based on the React-Native framework described in Embodiment 1 above can be implemented. All the steps involved in the method of the native object. For specific steps, please refer to the description of Embodiment 1, which will not be repeated here.

Embodiment 3

[0126] This embodiment corresponds to Embodiment 1 and Embodiment 2, and provides a specific application scenario:

[0127] Suppose the requirement is to implement a page that contains a carousel and a list of movies.

[0128] The data of the carousel image and the data of the movie list are obtained through different network requests, and the parameters are shown in Table 1 below:

[0129]

[0130] Table I

[0131] We can achieve this through the following steps:

[0132] 1. Customize a network module, implement the injection interface and create the interface.

[0133] 2. After the app is started, the network module will be saved in the original class pool; at the same time, when creating a page, a corresponding class will be generated in the JS class pool.

[0134] 3. In the JS code, we can search for the class corresponding to the network module in the JS class pool; then create two JS objects, that is, JS instances; one is passed to the parameter initialization of t...

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 provides a native object calling method for a JS, and a storage medium. The method comprises the steps of creating a native class pool, a native instance pool and a native agent module in a native layer, and mapping the native class pool, the native instance pool and the native agent module to a JS layer, thereby obtaining corresponding JS class pool, JS instance pool and JS agent module respectively; initiating a request of creating an instance corresponding to a native module to the JS agent module in the JS layer; sending a creation parameter of the instance comprised in the request to the native agent module by the JS agent module; and creating the native instance corresponding to the native module in the native instance pool according to the creation parameter by the native agent module, and mapping the native instance to the JS instance pool of the JS layer. According to the method, parallel calling of different interface requests can be realized, so that the interface request time is remarkably shortened, the problem of interface jamming is solved, and the user experience is improved.

Description

technical field [0001] The invention relates to the field of application program development, in particular to a method and a storage medium for calling native objects by JS. Background technique [0002] In the prior art, Apps for iOS and Android platforms can be developed based on the React-native framework. The React-Native framework (hereinafter referred to as the framework) is a cross-platform mobile application development framework open-sourced by Facebook in April 2015. It is a derivative of Facebook's earlier open-source UI framework React on the native mobile application platform. It currently supports iOS and Android platforms. The framework supports creating a native app through JS code. For platform APIs not encapsulated by the framework, developers are supported to customize native modules according to the rules, and then call them through JS. Simply put, the sdk is provided natively, and JS calls the sdk to realize the function. [0003] At present, the fra...

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
IPC IPC(8): G06F8/20G06F8/30
CPCG06F8/20G06F8/315
Inventor 刘德建黄明炜蔡睦堃郭玉湖
Owner FUJIAN TIANQUAN EDUCATION TECH LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products