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 reques

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

Example Embodiment

[0064] Example one

[0065] Please refer to Figure 2-Figure 11 This embodiment provides a method for calling native objects based on the JS of the React-Native framework. This embodiment is extended on the basis of the native module pool corresponding to the native module created on the JS layer of the prior art, which can realize the calling of the instance through the JS layer, can directly operate on the native instance, and then realize the in the instance pool The multiple native instances of NAS perform parallel operations, that is, multiple interfaces are operated in parallel, thereby shortening the time of data request, solving the interface stuck problem, and optimizing the user experience.

[0066] The method of this embodiment may include:

[0067] 1. Preliminary preparation stage:

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

Example Embodiment

[0123] Example two

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

Example Embodiment

[0125] Example three

[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 diagram and a list of movies.

[0128] The data of the carousel picture and the data of the movie list are obtained through different network requests. The parameters are shown in the following table:

[0129]

[0130] Table I

[0131] We can do it through the following steps:

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

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

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

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 Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products