js calls methods and storage media of native objects

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

Active Publication Date: 2022-04-01
FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF11 Cites 0 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
  • js calls methods and storage media of native objects
  • js calls methods and storage media of native objects
  • js calls methods and storage media of native objects

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 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 present invention provides a method and a storage medium for calling a native object by JS. The method includes: creating a native class pool, a native instance pool, and a native intermediary module in the native layer, and mapping them to the JS layer, respectively obtaining a corresponding A JS class pool, a JS instance pool, and a JS intermediary module; in the JS layer, a request for creating an instance corresponding to a native module is initiated to the JS intermediary module; the JS intermediary module sends the creation parameters of the instance contained in the request to the native intermediary module ; The native intermediary module creates a native instance corresponding to the native module in the native instance pool according to the creation parameters, and maps it to the JS instance pool of the JS layer. The invention can realize parallel calls to different interface requests, significantly shorten the interface request time, solve the interface stuck problem, and improve user experience.

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
Patent Type & Authority Patents(China)
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