CN110442399A - The React Native business of application executes method, apparatus, storage medium and terminal device - Google Patents
The React Native business of application executes method, apparatus, storage medium and terminal device Download PDFInfo
- Publication number
- CN110442399A CN110442399A CN201910736483.4A CN201910736483A CN110442399A CN 110442399 A CN110442399 A CN 110442399A CN 201910736483 A CN201910736483 A CN 201910736483A CN 110442399 A CN110442399 A CN 110442399A
- Authority
- CN
- China
- Prior art keywords
- react native
- business
- react
- service component
- file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
- G06F9/45508—Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
Abstract
This application involves application and development fields, method, apparatus, storage medium and controlling terminal are executed more particularly to a kind of React Native business of application, the described method includes: loading the React Native document framework of the application in response to the starting of application to initialize the React Native frame of the application;The component list of React Native business is obtained from the React Native frame of initialization;In response to specifying the starting of React Native business, the Service Component file that there is dependence with the specified React Native business is obtained from the component list of the React Native business, the execution code of the Service Component file acquisition Service Component is parsed, executes the execution code to start the specified React Native business.The application can separate the frame logic of application with service logic, execute service logic on demand, improve the efficiency of initiation of services.
Description
Technical field
This application involves application and development fields, and in particular to a kind of React Native business of application executes method, dress
It sets, storage medium and terminal device.
Background technique
Based on the application of React Native Development of Framework, React Native (RN) service code is packaged into a packet
File, which includes js (JavaScript) code of RN frame and the js code of RN business, in RN initiation of services, base
It compiles to compile by jsc engine in the application of RN Development of Framework and entirely wraps and execute business js code therein, and jsc, v8
There are performance bottlenecks in js compiling for equal js engine, and compiling is time-consuming and js code size is there are positively related relationship, and js code is got over
It is more, it compiles slower.And with the continuous iteration of Application Service Function, the volume of APMB package is increasing, during initiation of services
The time spent in the compiling of APMB package is more and more, and can execute js code much unrelated with current business, thus
Initiation of services performance is seriously affected, the starting efficiency of business is reduced.
Summary of the invention
To overcome the above technical problem, the especially prior art that can not efficiently start asking for React Native business
Topic, spy propose following technical scheme:
In a first aspect, this application provides a kind of React Native business of application to execute method, comprising:
In response to the starting of application, the React Native document framework of the application is loaded to initialize the application
React Native frame;The component list of ReactNative business is obtained from the React Native frame of initialization;
In response to specifying the starting of React Native business, obtained from the component list of the React Native business
The Service Component file that there is dependence with the specified React Native business is taken, the Service Component file is parsed and obtains
The execution code of the Service Component is taken, executes the execution code to start the specified React Native business.
Further, the React Native document framework of the application and React Native Service Component file pass through
Following method is packaged, comprising:
The entry file for obtaining the React Native frame of application, by the entry file of the React Native frame
It is packaged by being packaged script, generates React Native document framework;
Obtain the entry file of each React Native business;According to the entry file of each React Native business
The execution code of React Native business is split and is packaged, the React respectively based on React Native frame is generated
Native Service Component file;
According to the entry file of the React Native business calculate each React Native Service Component file according to
The relationship of relying generates the component list of React Native business.
Further, the entry file according to each React Native business is by React Native business
It executes code to split and be packaged, generates the respectively React Native Service Component file based on React Native frame, comprising:
The execution code of React Native business is split according to the entry file of each React Native business
At the React Native Service Component of minimum unit;
Unique identification marking is distributed for the React Native Service Component of each minimum unit;
The React Native Service Component of each minimum unit is packaged, is generated respectively based on React Native frame
React Native Service Component file.
Further, the starting in response to specifying React Native business, from the React Native business
The component list in obtain with the specified React Native business have dependence Service Component file, comprising:
In response to specifying the starting of React Native business, obtained from the component list of the React Native business
Take the request path for the Service Component file that there is dependence with the specified React Native business;
Corresponding Service Component file is requested to server according to the request path.
Further, the column of assemblies of React Native business is obtained in the React Native frame from initialization
Table, further includes:
According to React Native document framework described in the binary header protocol analysis of React Native document framework,
Obtain the configuration information of the component list of React Native business;
The execution code of the parsing Service Component file acquisition Service Component, comprising:
The Service Component file is parsed, the execution code starting position of the Service Component is calculated according to the configuration information
And end position, determine the execution code of the Service Component.
Further, described to be obtained and the specified React from the component list of the React Native business
Native business has after the Service Component file of dependence, further includes:
Obtain the priority of the Service Component file with dependence;
The execution code of the parsing Service Component file acquisition Service Component, comprising:
Corresponding Service Component file is successively parsed according to the priority of the Service Component file, obtains corresponding business
The execution code of component.
Second aspect, the application provide a kind of React Native business executive device of application, comprising:
Frame starting module: for the starting in response to application, the React Native document framework of the application is loaded
To initialize the React Native frame of the application;React is obtained from the React Native frame of initialization
The component list of Native business;
Initiation of services module: for the starting in response to specifying React Native business, from the React Native
The Service Component file that there is dependence with the specified React Native business, parsing are obtained in the component list of business
The execution code of the Service Component file acquisition Service Component executes the execution code to start the specified React
Native business.
Further, the initiation of services module further includes executing:
In response to specifying the starting of React Native business, obtained from the component list of the React Native business
Take the request path for the Service Component file that there is dependence with the specified React Native business;
Corresponding Service Component file is requested to server according to the request path.
The third aspect, present invention also provides a kind of computer readable storage medium, the computer readable storage medium
On be stored with computer program, which realizes the React Native business of above-mentioned application when being executed by processor
Execution method.
Fourth aspect, present invention also provides a kind of terminal device, the terminal device include one or more processors,
Memory, one or more computer programs, wherein one or more of computer programs are stored in the memory
And be configured as being executed by one or more of processors, one or more of programs are configured to carry out above-mentioned application
React Native business execute method.
The application compared with prior art, has the advantages that
This application provides a kind of methods that the React Native business to application executes on demand, in application starting,
The React Native document framework of the application is loaded, so that the React Native frame of the application is initialized, then from
The component list that React Native business is obtained in the React Native frame of initialization is only compiled at this time, is executed
The js code of React Native frame, and when the specified React Native business in starting application, then from the React
The Service Component text that there is dependence with the specified React Native business is obtained in the component list of Native business
Part compiles the js code of the Service Component file again at this time, obtains the execution code of the Service Component, then loads the execution generation
To start the specified React Native business, the js code of other React Native business for being not required to starting does not need code
Compiling, the frame logic of application is separated, and execute service logic as desired with service logic, reduces unrelated js code
Compiling, execute, thus improve needed for start business starting efficiency.
The additional aspect of the application and advantage will be set forth in part in the description, these will become from the following description
It obtains obviously, or recognized by the practice of the application.
Detailed description of the invention
The application is above-mentioned and/or additional aspect and advantage will become from the following description of the accompanying drawings of embodiments
Obviously and it is readily appreciated that, in which:
Fig. 1 is that the React Native business of the application application executes an embodiment flow diagram of method;
Fig. 2 is React Native document framework and the React Native Service Component file packing side of the application application
One embodiment flow diagram of method;
Fig. 3 is an embodiment schematic diagram of the React Native business executive device of the application application;
Fig. 4 is an example structure schematic diagram of the application controlling terminal.
Specific embodiment
Embodiments herein is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end
Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached
The embodiment of figure description is exemplary, and is only used for explaining the application, and cannot be construed to the limitation to the application.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singular " one " used herein, " one
It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in the description of the present application
Diction " comprising " refers to that there are the feature, integer, step, operations, but it is not excluded that in the presence of or addition it is one or more other
Feature, integer, step, operation.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art
Language and scientific term), there is meaning identical with the general understanding of those of ordinary skill in the application fields.Should also
Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art
The consistent meaning of meaning, and unless idealization or meaning too formal otherwise will not be used by specific definitions as here
To explain.
The React Native business that the embodiment of the present application provides a kind of application executes method, as shown in Figure 1, the method
The following steps are included:
S10: in response to the starting of application, the React Native document framework of the application is loaded to initialize described answer
React Native frame;The column of assemblies of React Native business is obtained from the React Native frame of initialization
Table.
Developer is based on cross-platform mobile application Development Framework (RN, React Native) development and application, the present embodiment
In application include application from zero building based on React Native frame or be integrated into React Native frame existing
Application in project, when application starting, by loading the React Native document framework of the application to initialize application
React Native frame, in the present embodiment, the React Native document framework includes
ReactInstanceManager file increases function in the ReactInstanceManager file
CreateCommonReactContext executes React by executing function createCommonReactContext
To initialize the React Native frame applied, this is opened starting code (startup code) inside Native document framework
Dynamic code startup code includes polyfills code, and the module of ccf layer is loaded and executed by require
Code.Further, it is initialized the React Native frame of application, is obtained from the React Native frame of initialization
The component list of React Native business, in the present embodiment, React Native skeleton code is present in independent one
In unbundle file (the i.e. described ReactNative document framework), and there are one in React Native lower portion
Service Component list (JSIndexedRAMBundleString list object), for managing needed for each React Native business
Use the Service Component arrived.
S20: the starting in response to specifying React Native business, from the component list of the React Native business
Middle acquisition has the Service Component file of dependence with the specified React Native business, parses the Service Component text
Part obtains the execution code of the Service Component, executes the execution code to start the specified React Native business.
In the present embodiment, when starting the specified React Native business in application, due to the React Native of application
Initialization is completed in frame, has the precondition of starting React Native business, at this point, from the React Native industry
The Service Component file that there is dependence with the specified React Native business is obtained in the component list of business, specifically
, the file path for the Service Component that there is dependence with the specified React Native business is obtained, according to the text
Part path searching calculates starting position and the end of the execution code of the Service Component to corresponding Service Component file
Position obtains corresponding execution code string, then executes the execution code, to start the specified React Native industry
Business.
A kind of method that the React Native business to application executes on demand is present embodiments provided, is started in application
When, the React Native document framework of the application is loaded, so that the React Native frame of the application is initialized, then
The component list that ReactNative business is obtained from the React Native frame of initialization is only compiled at this time, is executed
The js code of React Native frame, and when the specified React Native business in starting application, then from the React
The Service Component text that there is dependence with the specified React Native business is obtained in the component list of Native business
Part compiles the js code of the Service Component file again at this time, obtains the execution code of the Service Component, then loads the execution generation
To start the specified React Native business, the js code of other React Native business for being not required to starting does not need code
Compiling, the frame logic of application is separated, and execute service logic as desired with service logic, reduces unrelated js code
Compiling, execute, thus improve needed for start business starting efficiency.
A kind of embodiment of the application, as shown in Fig. 2, the React Native document framework and React of the application
Native Service Component file is packaged by the following method, comprising:
S30: obtaining the entry file of the React Native frame of application, by the entrance of the React Native frame
File is packaged by being packaged script, generates React Native document framework;
S31: the entry file of each React Native business is obtained;According to the entrance of each React Native business
The execution code of React Native business is split and is packaged by file, generates the React respectively based on React Native frame
Native Service Component file;
S32: each React Native Service Component file is calculated according to the entry file of the React Native business
Dependence, generate React Native business the component list.
React Native project (application) include Android Android Native project and IOS Native project extremely
One item missing and React Native project, the generation title in the present embodiment using application as the React Native project, are answered
The frame and component constituted in comprising a large amount of JS (Javascript) file in the present embodiment, splits the application into React
The React Native service scripts of Native document framework and each React Native business, specifically, the present embodiment is
React Native ccf layer introduces an individual entry file, and different React Native business is allowed to have respectively
Ingress for service file, then by the entry file of the React Native frame by be packaged script (metro) beaten
Packet, i.e., be packed into an individual file (common for all JS files (js modules) of React Native ccf layer
Unbundle in), React Native document framework is formed.
In the present embodiment, each React Native business has respective ingress for service file, by obtaining each React
Then the entry file of Native business will will be obscured originally all according to the entry file of each React Native business
The execution code of React Native business is split, and by the execution generation of each React Native business obtained after fractionation
Code is packaged, and the React Native Service Component file of each React Native business is formed, due to the React
Native business depends on React Native frame, that is, that generate is the React Native based on React Native frame
Service Component file.Further, the present embodiment limits the no entry file quantity of the packing of React Native Service Component
System, each React Native business can be packaged out respective React Native Service Component according to entry file
File.Further, each React Native Service Component is calculated further according to the entry file of the React Native business
The dependence of file, the component list for generating React Native business are recorded in React Native document framework.Institute
It states packing process and is first packaged generation React Native document framework, then be packaged and generate each React Native Service Component text
Part.
A kind of embodiment of the application, the entry file according to each React Native business is by React
The execution code of Native business splits and is packaged, and generates respectively based on the React Native service groups of React Native frame
Part file, comprising:
The execution code of React Native business is split according to the entry file of each React Native business
At the React Native Service Component of minimum unit;
Unique identification marking is distributed for the React Native Service Component of each minimum unit;
The React Native Service Component of each minimum unit is packaged, is generated respectively based on React Native frame
React Native Service Component file.
In the present embodiment, React Native business is using React Native Service Component (module) as minimum unit
Carry out tissue js code, when splitting and being packaged the execution code of React Native business, according to each React
The execution code of React Native business is split into the React Native of minimum unit by the entry file of Native business
Then Service Component distributes unique identification marking (module id) for the React Native Service Component of each minimum unit,
Guarantee that the React Native Service Component of each minimum unit is unique and mutually independent, then by each minimum unit
React Native Service Component is packaged, and generates the respectively React Native Service Component text based on React Native frame
Part, since React Native Service Component file has the path module path of storage, in conjunction with each React Native business
Component have unique identification marking module id, obtain one<module path, module id>object array, will
The object array sequence turns to a file, i.e., the component list of the React Native business in above-described embodiment.
A kind of embodiment of the application, the starting in response to specifying React Native business, from the React
The Service Component text that there is dependence with the specified React Native business is obtained in the component list of Native business
Part, comprising:
In response to specifying the starting of React Native business, obtained from the component list of the React Native business
Take the request path for the Service Component file that there is dependence with the specified React Native business;
Corresponding Service Component file is requested to server according to the request path.
In the present embodiment, after starting specified React Native business, the specified React Native business is needed
Service Component file is configured as readable state, and the Service Component file has been downloaded into local, in order to save local resource, this
In embodiment, in response to specifying the starting of React Native business, from the component list of the React Native business
Obtain the request path for the Service Component file that there is dependence with the specified React Native business, the React
What is saved in the component list of Native business is the storage path of each Service Component file on the server, passes through the storage road
Diameter is the request path that can determine Service Component file, then requests corresponding service groups to server according to the request path
Part file will need Service Component file download to be used to local at this time, subsequent to parse locally downloading service groups again
Part file obtains the execution code of the Service Component, executes the execution code to start the specified React Native industry
Business, to reduce the occupancy of local resource.
A kind of embodiment of the application obtains React Native industry in the React Native frame from initialization
The component list of business, further includes:
According to React Native document framework described in the binary header protocol analysis of React Native document framework,
Obtain the configuration information of the component list of React Native business;
The execution code of the parsing Service Component file acquisition Service Component, comprising:
The Service Component file is parsed, the execution code starting position of the Service Component is calculated according to the configuration information
And end position, determine the execution code of the Service Component.
In the present embodiment, since React Native skeleton code is present in independent React Native frame text
Part, in initialization React Native frame, when obtaining the component list of React Native business, also according to React
React Native document framework described in the binary header protocol analysis of Native document framework obtains React Native industry
The configuration information of the component list of business, the configuration information include minimal module id (the identification mark of minimal service component
Know), startup code length (executes code length), modules number (Service Component number) etc., then, subsequent
When parsing the execution code of the Service Component file acquisition Service Component, which just can be calculated according to the configuration information
The execution code starting position of component and end position, specifically, in the present embodiment, using require function according to module
Id, startup code length calculate execution code starting position and the end position of each Service Component, determine each business
The execution code of component, and the execution code of corresponding Service Component is loaded, avoid other execution codes of Service Component wrong
It accidentally executes, to improve the utilization rate of resource.
A kind of embodiment of the application, it is described to be obtained and the finger from the component list of the React Native business
After determining React Native business with the Service Component file of dependence, further includes:
Obtain the priority of the Service Component file with dependence;
The execution code of the parsing Service Component file acquisition Service Component, comprising:
Corresponding Service Component file is successively parsed according to the priority of the Service Component file, obtains corresponding business
The execution code of component.
In the present embodiment, obtained and the specified React from the component list of the React Native business
After Native business has the Service Component file of dependence, need the Service Component file all with dependence
It is parsed, and in order to guarantee the normal starting of business, the present embodiment obtains the Service Component file with dependence
Priority phase separation is successively solved according to the priority of the Service Component file then when parsing those Service Component files
The Service Component file answered obtains the execution code of corresponding Service Component, and the service scripts component of high priority is preferentially solved
Analysis, if high priority service scripts occur mistake and can not parse, even if subsequent Service Component file be parsed also without
Method normal use, by successively being parsed based on priority to Service Component file, if the Service Component of high priority can not
It is parsed, then investigation that current parsing work carries out Service Component can be stopped, avoiding disorderly executing Service Component
Parsing but occur mistake and waste resource, to improve the success rate that Service Component normally executes.
As shown in figure 3, in another embodiment, this application provides a kind of execution of the React Native business of application
Device, comprising:
Frame starting module 10: for the starting in response to application, the React Native frame text of the application is loaded
Part is to initialize the React Native frame of the application;React is obtained from the React Native frame of initialization
The component list of Native business;
Initiation of services module 20: for the starting in response to specifying React Native business, from the React
The Service Component text that there is dependence with the specified React Native business is obtained in the component list of Native business
Part parses the execution code of the Service Component file acquisition Service Component, executes the execution code to start the finger
Determine React Native business.
A kind of embodiment of the application, the React Native document framework and React Native service groups of the application
Part file is completed by packetization module;
The packetization module is used for: obtaining the entry file of each React Native business;According to each React
The execution code of React Native business is split and is packaged by the entry file of Native business, is generated and is respectively based on React
The React Native Service Component file of Native frame;It is calculated according to the entry file of the React Native business each
The dependence of React Native Service Component file generates the component list of React Native business.
A kind of embodiment of the application, the packetization module further include executing according to each React Native business
The execution code of React Native business is split into the React Native Service Component of minimum unit by entry file;It is each
The React Native Service Component of minimum unit distributes unique identification marking;By the React Native industry of each minimum unit
Business component is packaged, and generates the respectively React Native Service Component file based on React Native frame.
A kind of embodiment of the application, the initiation of services module 20 further include executing:
In response to specifying the starting of React Native business, obtained from the component list of the React Native business
Take the request path for the Service Component file that there is dependence with the specified React Native business;
Corresponding Service Component file is requested to server according to the request path.
A kind of embodiment of the application, the frame starting module 10 further include executing:
According to React Native document framework described in the binary header protocol analysis of React Native document framework,
Obtain the configuration information of the component list of React Native business;
The initiation of services module 20 further includes executing:
The Service Component file is parsed, the execution code starting position of the Service Component is calculated according to the configuration information
And end position, determine the execution code of the Service Component.
A kind of embodiment of the application, the initiation of services module 20 further include executing:
Obtain the priority of the Service Component file with dependence;
Corresponding Service Component file is successively parsed according to the priority of the Service Component file, obtains corresponding business
The execution code of component.
In another embodiment, this application provides a kind of computer readable storage medium, computer-readable storage mediums
Computer program is stored in matter, which realizes application described in above-described embodiment when being executed by processor
React Native business executes method.Wherein, the computer readable storage medium includes but is not limited to any kind of disk
(including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, read-only memory), RAM
(Random AcceSS Memory, immediately memory), EPROM (EraSable Programmable Read-Only
Memory, Erarable Programmable Read only Memory), EEPROM (Electrically EraSable Programmable
Read-Only Memory, Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or light card.It is, storage
Equipment includes that can be read-only memory with any medium for the form storage or transmission information that can be read by equipment, disk or
CD etc..
A kind of computer readable storage medium provided by the embodiments of the present application is, it can be achieved that starting in response to application, load
The React Native document framework of the application is to initialize the React Native frame of the application;From initialization
The component list of React Native business is obtained in React Native frame;In response to specifying React Native business
Starting, obtaining from the component list of the React Native business has dependence with the specified React Native business
The Service Component file of relationship parses the execution code of the Service Component file acquisition Service Component, executes the execution
Code is to start the specified React Native business.It is held on demand by providing a kind of React Native business to application
Capable method loads the React Native document framework of the application, to initialize the application in application starting
React Native frame, then from the React Native frame of initialization obtain React Native business column of assemblies
Table only compiles at this time, executes the js code of React Native frame, and as the specified React Native in starting application
When business, then obtains from the component list of the React Native business and have with the specified React Native business
The Service Component file of dependence compiles the js code of the Service Component file again at this time, obtains the execution of the Service Component
Then code loads the execution code to start the specified React Native business, other React for being not required to starting
The js code of Native business does not need to compile, and the frame logic of application is separated with service logic, and executes as desired
Service logic reduces the compiling of unrelated js code, executes, thus the starting efficiency of the business started needed for improving.
The React Native industry of above-mentioned application may be implemented in computer readable storage medium provided by the embodiments of the present application
The embodiment for execution method of being engaged in, concrete function realize the explanation referred in embodiment of the method, and details are not described herein.
In addition, the application also provides a kind of terminal device in another embodiment, as shown in figure 4, the terminal device
Including devices such as processor 403, memory 405, input unit 407 and display units 409.Those skilled in the art can manage
Solution, the structure devices shown in Fig. 4 do not constitute the restriction to all terminal devices, may include than illustrating more or fewer portions
Part, or the certain components of combination.The memory 405 can be used for storing computer program 401 and each functional module, the place
Reason device 403 runs the computer program 401 for being stored in memory 405, thereby executing the various function application and data of equipment
Processing.The memory 405 can be built-in storage or external memory, or including both built-in storage and external memory.It is interior
Memory may include that read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically-erasable can be compiled
Journey ROM (EEPROM), flash memory or random access memory.
Input unit 407 is used to receive the input of signal and receives the input of user, and input unit 407 may include touch surface
Plate and other input equipments, touch panel collect the touch operation of user on it or nearby, and according to preset
The corresponding attachment device of driven by program.Display unit 409 can be used for showing the information of user's input or be supplied to the information of user
And the various menus of computer equipment.The forms such as liquid crystal display, Organic Light Emitting Diode can be used in display unit 409.Place
Reason device 403 is that the control centre of computer equipment passes through fortune using the various pieces of various interfaces and the entire computer of connection
Row executes the software program and/or module being stored in memory 403, and calls the data being stored in memory, holds
The various functions of row and processing data.
In one embodiment, the terminal device includes that one or more processors 403 and one or more are deposited
Reservoir 405, one or more computer programs 401, wherein one or more of computer programs 401 are stored in memory
It in 405 and is configured as being executed by one or more of processors 403, one or more of computer programs 401 configure
React Native business for executing application described in above embodiments executes method.One or more shown in Fig. 4
Processor 403 is able to carry out, realizes the function of frame starting module 10, initiation of services module 20 shown in Fig. 3.
A kind of terminal device provided by the embodiments of the present application loads the application, it can be achieved that starting in response to application
React Native document framework is to initialize the React Native frame of the application;From the React Native of initialization
The component list of React Native business is obtained in frame;In response to specifying the starting of React Native business, from described
The business that there is dependence with the specified React Native business is obtained in the component list of React Native business
Component file parses the execution code of the Service Component file acquisition Service Component, executes the execution code to start
The specified React Native business.By providing a kind of method that the React Native business to application executes on demand,
In application starting, the React Native document framework of the application is loaded, to initialize the React of the application
Native frame, then from the React Native frame of initialization obtain React Native business the component list, at this time
The js code of React Native frame is only compiled, executes, and when the specified React Native business in starting application,
It obtains to have to rely on the specified React Native business from the component list of the React Native business again and close
The Service Component file of system compiles the js code of the Service Component file again at this time, obtains the execution code of the Service Component, so
After load the execution code to start the specified React Native business, other React Native business for being not required to starting
Js code do not need to compile, the frame logic of application is separated, and execute service logic as desired with service logic, is subtracted
The compiling of few unrelated js code executes, thus the starting efficiency of the business started needed for improving.
The React Native business that the application of above-mentioned offer may be implemented in terminal device provided by the embodiments of the present application is held
The embodiment of row method, concrete function realize the explanation referred in embodiment of the method, and details are not described herein.
The above is only some embodiments of the application, it is noted that for the ordinary skill people of the art
For member, under the premise of not departing from the application principle, several improvements and modifications can also be made, these improvements and modifications are also answered
It is considered as the protection scope of the application.
Claims (10)
1. a kind of React Native business of application executes method, which comprises the following steps:
In response to the starting of application, the React Native document framework of the application is loaded to initialize the application
React Native frame;The component list of React Native business is obtained from the React Native frame of initialization;
In response to specify React Native business starting, from the component list of the React Native business obtain with
The specified React Native business has the Service Component file of dependence, and parsing the Service Component file acquisition should
The execution code of Service Component executes the execution code to start the specified React Native business.
2. the method according to claim 1, wherein the React Native document framework of the application and
React Native Service Component file is packaged by the following method, comprising:
The entry file for obtaining the React Native frame of application, the entry file of the React Native frame is passed through
It is packaged script to be packaged, generates React Native document framework;
Obtain the entry file of each React Native business;It will according to the entry file of each React Native business
The execution code of React Native business splits and is packaged, and generates the React Native respectively based on React Native frame
Service Component file;
It is closed according to the dependence that the entry file of the React Native business calculates each React Native Service Component file
System generates the component list of React Native business.
3. according to the method described in claim 2, it is characterized in that, the entrance according to each React Native business
The execution code of React Native business is split and is packaged by file, generates the React respectively based on React Native frame
Native Service Component file, comprising:
The execution code of React Native business is split into most according to the entry file of each React Native business
The React Native Service Component of junior unit;
Unique identification marking is distributed for the React Native Service Component of each minimum unit;
The React Native Service Component of each minimum unit is packaged, the React respectively based on React Native frame is generated
Native Service Component file.
4. the method according to claim 1, wherein described in response to specifying opening for React Native business
It is dynamic, it obtains to have to rely on the specified React Native business from the component list of the React Native business and close
The Service Component file of system, comprising:
In response to specify React Native business starting, from the component list of the React Native business obtain with
The specified React Native business has the request path of the Service Component file of dependence;
Corresponding Service Component file is requested to server according to the request path.
5. the method according to claim 1, wherein being obtained in the React Native frame from initialization
The component list of React Native business, further includes:
According to React Native document framework described in the binary header protocol analysis of React Native document framework, obtain
The configuration information of the component list of React Native business;
The execution code of the parsing Service Component file acquisition Service Component, comprising:
The Service Component file is parsed, execution code starting position and the knot of the Service Component are calculated according to the configuration information
Beam position determines the execution code of the Service Component.
6. the method according to claim 1, wherein described the component list from the React Native business
Middle acquisition has with the specified React Native business after the Service Component file of dependence, further includes:
Obtain the priority of the Service Component file with dependence;
The execution code of the parsing Service Component file acquisition Service Component, comprising:
Corresponding Service Component file is successively parsed according to the priority of the Service Component file, obtains corresponding Service Component
Execution code.
7. a kind of React Native business executive device of application characterized by comprising
Frame starting module: for the starting in response to application, the React Native document framework of the application is loaded with first
The React Native frame of the beginningization application;React Native industry is obtained from the React Native frame of initialization
The component list of business;
Initiation of services module: for the starting in response to specifying React Native business, from the React Native business
The component list in obtain the Service Component file that there is dependence with the specified React Native business, described in parsing
The execution code of the Service Component file acquisition Service Component executes the execution code to start the specified React
Native business.
8. device according to claim 7, which is characterized in that the initiation of services module further includes executing:
In response to specify React Native business starting, from the component list of the React Native business obtain with
The specified React Native business has the request path of the Service Component file of dependence;
Corresponding Service Component file is requested to server according to the request path.
9. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium
Program, the computer program realize the React of application as claimed in any one of claims 1 to 6 when being executed by processor
Native business executes method.
10. a kind of terminal device characterized by comprising
One or more processors;
Memory;
One or more computer programs, wherein one or more of computer programs are stored in the memory and quilt
It is configured to be executed by one or more of processors, one or more of computer programs are configured to carry out according to right
It is required that the React Native business of 1 to 6 described in any item applications executes method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910736483.4A CN110442399B (en) | 2019-08-09 | 2019-08-09 | Method and device for executing read Native service of application, storage medium and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910736483.4A CN110442399B (en) | 2019-08-09 | 2019-08-09 | Method and device for executing read Native service of application, storage medium and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110442399A true CN110442399A (en) | 2019-11-12 |
CN110442399B CN110442399B (en) | 2022-08-16 |
Family
ID=68434440
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910736483.4A Active CN110442399B (en) | 2019-08-09 | 2019-08-09 | Method and device for executing read Native service of application, storage medium and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110442399B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112416458A (en) * | 2020-11-20 | 2021-02-26 | 平安普惠企业管理有限公司 | Preloading method and device based on ReactNative, computer equipment and storage medium |
CN112416466A (en) * | 2020-12-02 | 2021-02-26 | 车智互联(北京)科技有限公司 | Application program loading method, mobile terminal and readable storage medium |
CN113918241A (en) * | 2021-10-27 | 2022-01-11 | 挂号网(杭州)科技有限公司 | Application running method and device, electronic equipment and storage medium |
Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1945530A (en) * | 2006-11-07 | 2007-04-11 | 中兴通讯股份有限公司 | Arranging system and method for module having dependence |
CN103810172A (en) * | 2012-11-06 | 2014-05-21 | 金蝶软件(中国)有限公司 | Method and device for generating module dependence relationship graph |
CN105138352A (en) * | 2015-07-31 | 2015-12-09 | 百度在线网络技术(北京)有限公司 | Method and apparatus for installing application plugins |
CN106843820A (en) * | 2015-12-04 | 2017-06-13 | 阿里巴巴集团控股有限公司 | Code process method and apparatus |
CN107168730A (en) * | 2017-04-14 | 2017-09-15 | 北京五八信息技术有限公司 | application program loading method, server and terminal |
CN107577515A (en) * | 2017-10-10 | 2018-01-12 | 北京小度信息科技有限公司 | Extended method, device, electronic equipment and the storage medium of visualization component |
CN107861766A (en) * | 2017-06-26 | 2018-03-30 | 平安普惠企业管理有限公司 | Using startup method, apparatus and computer-readable recording medium |
CN108108239A (en) * | 2017-12-29 | 2018-06-01 | 咪咕文化科技有限公司 | A kind of providing method of business function, device and computer readable storage medium |
CN108512672A (en) * | 2017-02-24 | 2018-09-07 | 华为技术有限公司 | Arranging service method, business management method and device |
CN108845839A (en) * | 2018-05-31 | 2018-11-20 | 康键信息技术(深圳)有限公司 | Application page loading method, device and computer readable storage medium |
CN109189729A (en) * | 2018-09-03 | 2019-01-11 | 五八有限公司 | Lookup method, device, equipment and the storage medium of each inter-module dependence |
CN109298900A (en) * | 2018-10-23 | 2019-02-01 | 中国农业银行股份有限公司 | A kind of application fractionation and on-demand loading method, apparatus |
CN109783744A (en) * | 2018-12-05 | 2019-05-21 | 北京奇艺世纪科技有限公司 | The page starts method, apparatus, terminal and computer readable storage medium |
CN109840116A (en) * | 2017-11-27 | 2019-06-04 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus loading resource file |
CN110007980A (en) * | 2019-01-29 | 2019-07-12 | 阿里巴巴集团控股有限公司 | The implementation method and device at multi-services end |
-
2019
- 2019-08-09 CN CN201910736483.4A patent/CN110442399B/en active Active
Patent Citations (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1945530A (en) * | 2006-11-07 | 2007-04-11 | 中兴通讯股份有限公司 | Arranging system and method for module having dependence |
CN103810172A (en) * | 2012-11-06 | 2014-05-21 | 金蝶软件(中国)有限公司 | Method and device for generating module dependence relationship graph |
CN105138352A (en) * | 2015-07-31 | 2015-12-09 | 百度在线网络技术(北京)有限公司 | Method and apparatus for installing application plugins |
CN106843820A (en) * | 2015-12-04 | 2017-06-13 | 阿里巴巴集团控股有限公司 | Code process method and apparatus |
CN108512672A (en) * | 2017-02-24 | 2018-09-07 | 华为技术有限公司 | Arranging service method, business management method and device |
CN107168730A (en) * | 2017-04-14 | 2017-09-15 | 北京五八信息技术有限公司 | application program loading method, server and terminal |
CN107861766A (en) * | 2017-06-26 | 2018-03-30 | 平安普惠企业管理有限公司 | Using startup method, apparatus and computer-readable recording medium |
CN107577515A (en) * | 2017-10-10 | 2018-01-12 | 北京小度信息科技有限公司 | Extended method, device, electronic equipment and the storage medium of visualization component |
CN109840116A (en) * | 2017-11-27 | 2019-06-04 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus loading resource file |
CN108108239A (en) * | 2017-12-29 | 2018-06-01 | 咪咕文化科技有限公司 | A kind of providing method of business function, device and computer readable storage medium |
CN108845839A (en) * | 2018-05-31 | 2018-11-20 | 康键信息技术(深圳)有限公司 | Application page loading method, device and computer readable storage medium |
CN109189729A (en) * | 2018-09-03 | 2019-01-11 | 五八有限公司 | Lookup method, device, equipment and the storage medium of each inter-module dependence |
CN109298900A (en) * | 2018-10-23 | 2019-02-01 | 中国农业银行股份有限公司 | A kind of application fractionation and on-demand loading method, apparatus |
CN109783744A (en) * | 2018-12-05 | 2019-05-21 | 北京奇艺世纪科技有限公司 | The page starts method, apparatus, terminal and computer readable storage medium |
CN110007980A (en) * | 2019-01-29 | 2019-07-12 | 阿里巴巴集团控股有限公司 | The implementation method and device at multi-services end |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112416458A (en) * | 2020-11-20 | 2021-02-26 | 平安普惠企业管理有限公司 | Preloading method and device based on ReactNative, computer equipment and storage medium |
CN112416466A (en) * | 2020-12-02 | 2021-02-26 | 车智互联(北京)科技有限公司 | Application program loading method, mobile terminal and readable storage medium |
CN112416466B (en) * | 2020-12-02 | 2024-02-23 | 车智互联(北京)科技有限公司 | Application program loading method, mobile terminal and readable storage medium |
CN113918241A (en) * | 2021-10-27 | 2022-01-11 | 挂号网(杭州)科技有限公司 | Application running method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110442399B (en) | 2022-08-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108287694B (en) | Application program construction method, system, computer device and storage medium | |
CN110442399A (en) | The React Native business of application executes method, apparatus, storage medium and terminal device | |
CN108399132B (en) | Scheduling test method, device and storage medium | |
US9009663B2 (en) | Cartridge-based package management | |
US10303490B2 (en) | Apparatus and method for optimizing startup of embedded system | |
CN105204917B (en) | The method and device of loading configuration file in application program launching | |
CN105490860A (en) | Method, device and system for deploying application program operation environment | |
EP3276488A1 (en) | Deployment system for multi-node applications | |
CN109347652A (en) | The service management and device of server cluster | |
CN108228444B (en) | Test method and device | |
CN111930382B (en) | Application page access method, device and equipment | |
CN108279940B (en) | Module loading method and device in web container | |
US8627201B2 (en) | Method for generating simple object access protocol messages and process engine | |
CN108429787B (en) | Container deployment method and device, computer storage medium and terminal | |
US10866803B2 (en) | Generating interaction libraries | |
US20200159536A1 (en) | Unicontainers | |
CN108845839A (en) | Application page loading method, device and computer readable storage medium | |
CN110069259A (en) | Analytic method, device, electronic equipment and storage medium based on idl file | |
CN112769706B (en) | Componentized routing method and system | |
CN110716786B (en) | Page display method, system and storage medium | |
CN109840103A (en) | Update method, device and the storage medium of Application Container | |
CN110020370B (en) | Method and device for realizing animation in client application and framework of animation script | |
CN109582382A (en) | Loading method, device, storage medium and the terminal device of configuration information | |
CN110659022B (en) | Method for automatically calling Python script based on Java | |
CN112732265B (en) | Data processing method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |