CN110442399B - Method and device for executing read Native service of application, storage medium and terminal equipment - Google Patents
Method and device for executing read Native service of application, storage medium and terminal equipment Download PDFInfo
- Publication number
- CN110442399B CN110442399B CN201910736483.4A CN201910736483A CN110442399B CN 110442399 B CN110442399 B CN 110442399B CN 201910736483 A CN201910736483 A CN 201910736483A CN 110442399 B CN110442399 B CN 110442399B
- Authority
- CN
- China
- Prior art keywords
- service
- native
- file
- real
- component
- 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.)
- Active
Links
Images
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
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application relates to the field of application development, in particular to a method and a device for executing a read Native service of an application, a storage medium and a control terminal, wherein the method comprises the following steps: in response to the starting of the application, loading a React Native framework file of the application to initialize the React Native framework of the application; acquiring a component list of the React Native service from the initialized React Native framework; responding to the starting of the appointed reach Native service, acquiring a service component file which has a dependency relationship with the appointed reach Native service from a component list of the reach Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed reach Native service. The method and the device can separate the applied frame logic from the service logic, execute the service logic as required, and improve the efficiency of service starting.
Description
Technical Field
The application relates to the field of application development, in particular to a method and a device for executing a read Native service of an application, a storage medium and a terminal device.
Background
The application developed based on the React Native framework packs the React Native (RN) service codes into a packet file, the packet file comprises js (JavaScript) codes of the RN framework and js codes of the RN service, when the RN service is started, the application developed based on the RN framework compiles and compiles the whole packet by means of an jsc engine and executes the js codes of the service in the packet, but js engines such as jsc, v8 and the like have performance bottleneck in js compilation, the compiling time consumption and the size of the js codes have positive correlation, and the more the js codes are, the slower the compiling is. With the continuous iteration of the application service function, the volume of the package file is larger and larger, more and more time is spent on compiling the package file in the service starting process, and a plurality of js codes irrelevant to the current service can be executed, so that the service starting performance is seriously influenced, and the service starting efficiency is reduced.
Disclosure of Invention
In order to overcome the technical problems, particularly the problem that the prior art cannot efficiently start the read Native service, the following technical scheme is provided:
in a first aspect, the present application provides a method for executing a read Native service of an application, including:
in response to the starting of the application, loading a React Native framework file of the application to initialize the React Native framework of the application; acquiring a component list of ReactNative service from the initialized ReactNative framework;
responding to the starting of the appointed real Native service, acquiring a service component file which has a dependency relationship with the appointed real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed real Native service.
Further, the packing of the read Native framework file and the read Native service component file of the application is performed by the following method, including:
acquiring an entry file of an applied React Native framework, and packaging the entry file of the React Native framework through a packaging script to generate a React Native framework file;
acquiring an entry file of each read Native service; splitting and packaging the execution codes of the real Native services according to the entry files of the real Native services to generate real Native service component files based on the real Native framework;
and calculating the dependency relationship of each real Native service component file according to the entry files of the real Native services, and generating a component list of the real Native services.
Further, the splitting and packaging the execution code of the real Native service according to the entry file of each real Native service to generate each real Native service component file based on the real Native framework, including:
splitting the execution code of the real Native service into a real Native service component with the smallest unit according to the entry file of each real Native service;
allocating unique identification marks for the read Native service components of the minimum units;
and packaging the React Native service components of each minimum unit to generate React Native service component files based on the React Native framework.
Further, the acquiring, in response to the starting of the specified real Native service, a service component file having a dependency relationship with the specified real Native service from the component list of the real Native service includes:
responding to the starting of the appointed real Native service, and acquiring a request path of a service component file having a dependency relationship with the appointed real Native service from a component list of the real Native service;
and requesting a corresponding service component file from the server according to the request path.
Further, the obtaining of the component list of the real Native service from the initialized real Native framework further includes:
analyzing the real Native framework file according to a binary header protocol of the real Native framework file, and acquiring configuration information of a component list of the real Native service;
the analyzing the service component file to obtain the execution code of the service component comprises the following steps:
analyzing the service assembly file, calculating the starting position and the ending position of the execution code of the service assembly according to the configuration information, and determining the execution code of the service assembly.
Further, after acquiring the service component file having a dependency relationship with the specified real Native service from the component list of the real Native service, the method further includes:
acquiring the priority of the service component file with the dependency relationship;
the analyzing the service component file to obtain the execution code of the service component comprises the following steps:
and analyzing the corresponding service component files in sequence according to the priority of the service component files to obtain the execution codes of the corresponding service components.
In a second aspect, the present application provides a read Native service execution apparatus for an application, including:
a frame starting module: the real Native framework file is used for loading the real Native framework file of the application to initialize the real Native framework of the application in response to the starting of the application; acquiring a component list of the React Native service from the initialized React Native framework;
a service starting module: the method is used for responding to the starting of the appointed real Native service, acquiring a service component file which has a dependency relationship with the appointed real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed real Native service.
Further, the service initiation module further performs:
responding to the starting of the appointed real Native service, and acquiring a request path of a service component file having a dependency relationship with the appointed real Native service from a component list of the real Native service;
and requesting a corresponding service component file from the server according to the request path.
In a third aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the read Native service execution method of the application.
In a fourth aspect, the present application also provides a terminal device comprising one or more processors, a memory, one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the read Native service execution method of the application.
Compared with the prior art, the application has the following beneficial effects:
the application provides a method for executing application React Native services as required, when the application is started, loading the React Native framework file of the application so as to initialize the React Native framework of the application, then obtaining the component list of the React Native services from the initialized React Native framework, only compiling and executing js codes of the React Native framework, when the application is started to specify the React Native services, then obtaining the service component files which have dependency relationship with the specified ct Native services from the component list of the React Native services, then compiling the js codes of the service component files to obtain the execution codes of the service components, then loading the execution codes to start the specified React Native services, and the js codes of other React Native services which do not need to be started do not need compiling, separating the framework logic of the application from the service logic, and executing the service logic as required, and compiling and executing irrelevant js codes are reduced, so that the starting efficiency of the service needing to be started is improved.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flow chart of an embodiment of a read Native service execution method applied in the present application;
fig. 2 is a schematic flow chart of an embodiment of a method for packaging a read Native framework file and a read Native service component file applied in the present application;
fig. 3 is a schematic diagram of an embodiment of a read Native service execution apparatus applied in the present application;
fig. 4 is a schematic structural diagram of an embodiment of a control terminal according to the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, or operations, but do not preclude the presence or addition of one or more other features, integers, steps, operations, or groups thereof.
It will be understood by those within the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The embodiment of the application provides a method for executing a read Native service of an application, as shown in fig. 1, the method includes the following steps:
s10: in response to the starting of the application, loading a React Native framework file of the application to initialize the React Native framework of the application; and acquiring a component list of the real Native service from the initialized real Native framework.
The method comprises the steps that a developer develops an application based on a cross-platform mobile application development framework (RN), the application in the embodiment comprises the application which is constructed from zero and based on a real Native framework or the application which integrates the real Native framework into an existing project, when the application is started, a real Native framework file of the application is loaded to initialize the real Native framework of the application, the real Native framework file comprises a real instancemanager file, a function createCommonContext is added into the real instancemanager file, a starting code (startup code) in the real Native framework file is executed to initialize the real Native framework of the application by executing the function createCommonReactContext, and the starting code startups code comprises a polyfile code, and a module code of a framework layer is loaded and executed by a require. Furthermore, an application read Native framework is initialized, and a component list of the read Native service is obtained from the initialized read Native framework.
S20: responding to the starting of the appointed real Native service, acquiring a service component file which has a dependency relationship with the appointed real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed real Native service.
In this embodiment, when a specific read Native service in an application is started, since the read Native framework of the application is initialized, and the application has a precondition for starting the read Native service, at this time, a service component file having a dependency relationship with the specific read Native service is obtained from a component list of the read Native service, specifically, a file path of a service component having a dependency relationship with the specific read Native service is obtained, a corresponding service component file is found according to the file path, a start position and an end position of an execution code of the service component are calculated, a corresponding execution code string is obtained, and then the execution code is executed, so that the specific read Native service is started.
The embodiment provides a method for executing application React Native services as required, when an application is started, loading a React Native framework file of the application so as to initialize the React Native framework of the application, then obtaining a component list of the React Native services from the initialized React Native framework, only compiling and executing js codes of the React Native framework at the moment, when the application is started to specify the React Native services, then obtaining a service component file which has a dependence relationship with the specified React Native services from the component list of the React Native services, at the moment, compiling the js codes of the service component file to obtain execution codes of the service components, then loading the execution codes to start the specified React Native services, wherein the js codes of other React Native services which do not need to be started do not need to be compiled, separating the framework logic of the application from the service logic, and executing the service logic as required, and compiling and executing irrelevant js codes are reduced, so that the starting efficiency of the service needing to be started is improved.
In an embodiment of the present application, as shown in fig. 2, the packing of the read Native framework file and the read Native service component file of the application is performed by the following method, including:
s30: acquiring an entry file of an applied React Native framework, and packaging the entry file of the React Native framework through a packaging script to generate a React Native framework file;
s31: acquiring an entry file of each read Native service; splitting and packaging the execution codes of the real Native services according to the entry files of the real Native services to generate real Native service component files based on the real Native framework;
s32: and calculating the dependency relationship of each real Native service component file according to the entry files of the real Native services, and generating a component list of the real Native services.
The method includes the steps that an application is taken as a representative of the read Native project, the application comprises a frame and components formed by a large number of JS (Javascript) files, the application is split into a read Native frame file and a read Native service file of each read Native service, specifically, the embodiment is that an independent entry file is introduced into a read Native frame layer, different read Native services are allowed to have respective service entry files, and then the entry files of the read Native frame layer are packaged through a packaging script (metro), namely, all JS files (JS modules) of the read Native frame layer are packaged into an independent file (mon unandbull), and the read Native frame file is formed.
In this embodiment, each of the real Native services has its own service entry file, and by obtaining the entry file of each of the real Native services, and then splitting the execution codes originally confusing all of the real Native services according to the entry file of each of the real Native services, and packaging the execution codes of each of the real Native services obtained after the splitting, a real Native service component file of each of the real Native services is formed. Furthermore, the embodiment has no limitation on the number of the entry files for packaging the real Native service components, and each real Native service can package a respective real Native service component file according to the entry files. And further, calculating the dependency relationship of each read Native service component file according to the entry file of the read Native service, and generating a component list of the read Native service to be recorded in the read Native framework file. And the packaging process firstly packages and generates the real Native framework files, and then packages and generates each real Native service component file.
According to an embodiment of the application, the method for generating the read Native service component files based on the read Native framework includes the steps of splitting and packaging the execution codes of the read Native services according to the entry files of the read Native services, and includes:
splitting the execution code of the real Native service into a real Native service component with the smallest unit according to the entry file of each real Native service;
allocating unique identification marks for the read Native service components of the minimum units;
and packaging the React Native service components of each minimum unit to generate React Native service component files based on the React Native framework.
In the embodiment, the real Native service organizes js codes by taking a real Native service component (module) as a minimum unit, when the execution codes of the real Native service are split and packaged, the execution codes of the real Native service are split into the real Native service components of the minimum units according to the entry files of the real Native service, unique identification (module id) is distributed to the real Native service components of the minimum units, the fact that the real Native service components of each minimum unit are unique and mutually independent is ensured, the real Native service components of each minimum unit are packaged to generate the real Native service component files based on the real Native framework, because the real Native service component files have deposited path module pages, each real Native service component has unique identification module, and an object array of < the real page > module is obtained, the object array is serialized into a file, i.e. the component list of the read Native service in the above embodiment.
In one embodiment of the present application, the acquiring, in response to the start of a specified real Native service, a service component file having a dependency relationship with the specified real Native service from a component list of the real Native service includes:
responding to the starting of the appointed React Native service, and acquiring a request path of a service component file which has a dependency relationship with the appointed React Native service from a component list of the React Native service;
and requesting a corresponding service component file from the server according to the request path.
In the embodiment, after a specified React Native service is started, a service component file needing the specified React Native service is configured to be in a readable state and is downloaded to the local, in order to save local resources, in the embodiment, in response to the start of the specified React Native service, a request path of the service component file having a dependency relationship with the specified React Native service is obtained from a component list of the React Native service, a storage path of each service component file on a server is stored in the component list of the React Native service, the request path of the service component file can be determined through the storage path, then the corresponding service component file is requested from the server according to the request path, so as to download the service component file needing to be used to the local, and then the service component file is analyzed and downloaded to the local service component file to obtain an execution code of the service component, and executing the execution code to start the specified read Native service, thereby reducing occupation of local resources.
In an embodiment of the present application, the obtaining a component list of the fact Native service from the initialized fact Native framework further includes:
analyzing the real Native framework file according to a binary header protocol of the real Native framework file, and acquiring configuration information of a component list of the real Native service;
the analyzing the service component file to obtain the execution code of the service component comprises the following steps:
analyzing the service assembly file, calculating the starting position and the ending position of the execution code of the service assembly according to the configuration information, and determining the execution code of the service assembly.
In this embodiment, because the read Native framework code exists in an independent read Native framework file, when initializing the read Native framework and obtaining the component list of the read Native service, the read Native framework file is also parsed according to the binary header protocol of the read Native framework file, and the configuration information of the component list of the read Native service is obtained, where the configuration information includes a minor module id (identification of the minimum service component), a startup code length (length of the execution code), a number of modules (number of service components), and the like, and then, when subsequently parsing the service component file to obtain the execution code of the service component, the execution code start position and the end position of the service component can be calculated according to the configuration information, specifically, in this embodiment, the execution code start position and the end position of each service component are calculated according to the module and the startup code length by using a request function, and determining the execution code of each service component, and loading the execution code of the corresponding service component, so that other execution codes of the service components are prevented from being executed wrongly, and the utilization rate of resources is improved.
In an embodiment of the present application, after obtaining a service component file having a dependency relationship with the specified real Native service from the component list of the real Native service, the method further includes:
acquiring the priority of the service component file with the dependency relationship;
the analyzing the service component file to obtain the execution code of the service component comprises the following steps:
and analyzing the corresponding service component files in sequence according to the priority of the service component files to obtain the execution codes of the corresponding service components.
In this embodiment, after acquiring the service component files having a dependency relationship with the specified read Native service from the component list of the read Native service, all the service component files having a dependency relationship need to be parsed, and in order to ensure normal start of the service, in this embodiment, the priority of the service component files having a dependency relationship is acquired, and then, when parsing the service component files, the corresponding service component files are sequentially parsed according to the priority of the service component files, the execution codes of the corresponding service components are acquired, the service file components having a high priority are preferentially parsed, if the service files having a high priority are wrong and cannot be parsed, the subsequent service component files cannot be normally used even if the parsing is completed, the service component files are sequentially parsed based on the priority, and if the service components having a high priority cannot be parsed, the current analysis work can be stopped, then the business components can be checked, resources which are wasted due to errors when the analysis of the business components is executed out of order are avoided, and therefore the success rate of normal execution of the business components is improved.
As shown in fig. 3, in another embodiment, the present application provides a read Native service execution apparatus for an application, including:
frame start module 10: the real Native framework file is used for responding to the starting of the application and loading the real Native framework file of the application so as to initialize the real Native framework of the application; acquiring a component list of the React Native service from the initialized React Native framework;
the service initiation module 20: the method is used for responding to the starting of the appointed real Native service, acquiring a service component file which has a dependency relationship with the appointed real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed real Native service.
According to one embodiment of the application, the React Native framework file and the React Native service component file of the application are completed through a packaging module;
the packaging module is used for: acquiring an entry file of each read Native service; splitting and packaging the execution codes of the real Native services according to the entry files of the real Native services to generate real Native service component files based on the real Native framework; and calculating the dependency relationship of each real Native service component file according to the entry files of the real Native services, and generating a component list of the real Native services.
In an embodiment of the present application, the packaging module further includes a read Native service component that executes the read Native service according to the entry file of each read Native service to split the execution code of the read Native service into a minimum unit; allocating unique identification marks for the read Native service components of the minimum units; and packaging the reach Native service components of each minimum unit to generate reach Native service component files based on the reach Native framework.
In an embodiment of the present application, the service starting module 20 further performs:
responding to the starting of the appointed real Native service, and acquiring a request path of a service component file having a dependency relationship with the appointed real Native service from a component list of the real Native service;
and requesting a corresponding service component file from the server according to the request path.
In an embodiment of the present application, the framework startup module 10 further performs:
analyzing the read Native frame file according to a binary header protocol of the read Native frame file, and acquiring configuration information of a component list of the read Native service;
the service initiation module 20 further performs:
analyzing the service assembly file, calculating the starting position and the ending position of the execution code of the service assembly according to the configuration information, and determining the execution code of the service assembly.
In an embodiment of the present application, the service starting module 20 further performs:
acquiring the priority of the service component file with the dependency relationship;
and analyzing the corresponding service component files in sequence according to the priority of the service component files to obtain the execution codes of the corresponding service components.
In another embodiment, the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the read Native service execution method of the application described in the above embodiment. The computer-readable storage medium includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random AcceSS memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage device includes any medium that stores or transmits information in a form readable by a device, and may be a read-only memory, a magnetic or optical disk, or the like.
The computer-readable storage medium provided by the embodiment of the application can be used for loading the read Native framework file of the application to initialize the read Native framework of the application in response to the start of the application; acquiring a component list of the React Native service from the initialized React Native framework; responding to the starting of the appointed real Native service, acquiring a service component file which has a dependency relationship with the appointed real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed real Native service. By providing a method for executing the application React Native service as required, when the application is started, loading the React Native framework file of the application to initialize the React Native framework of the application, then obtaining the component list of the React Native service from the initialized React Native framework, compiling and executing only the js code of the React Native framework, when the application is started to specify the React Native service, then obtaining the service component file which has dependency relationship with the specified React Native service from the component list of the React Native service, then compiling the js code of the service component file to obtain the execution code of the service component, then loading the execution code to start the specified React Native service, the js codes of other React Native services which do not need to be started do not need to be compiled, separating the framework logic from the service logic of the application, and executing the service logic as required, and compiling and executing irrelevant js codes are reduced, so that the starting efficiency of the service needing to be started is improved.
The computer-readable storage medium provided in the embodiment of the present application can implement the embodiment of the read Native service execution method of the application, and for specific function implementation, reference is made to the description in the method embodiment, which is not described herein again.
In addition, in another embodiment, the present application further provides a terminal device, as shown in fig. 4, the terminal device includes a processor 403, a memory 405, an input unit 407, a display unit 409, and other devices. Those skilled in the art will appreciate that the structural elements shown in fig. 4 do not constitute a limitation of all terminal devices and may include more or fewer components than those shown, or some of the components may be combined. The memory 405 may be used to store the computer program 401 and the functional modules, and the processor 403 executes the computer program 401 stored in the memory 405, thereby executing various functional applications of the device and data processing. The memory 405 may be an internal memory or an external memory, or include both internal and external memories. The memory may comprise read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), flash memory, or random access memory.
The input unit 407 is configured to receive input of signals and input of a user, and the input unit 407 may include a touch panel and other input devices, where the touch panel may collect touch operations of the user on or near the touch panel and drive a corresponding connection device according to a preset program. The display unit 409 may be used to display information input by a user or information provided to a user and various menus of the computer device. The display unit 409 may take the form of a liquid crystal display, an organic light emitting diode, or the like. The processor 403 is a control center of the computer device, connects various parts of the entire computer using various interfaces and lines, and performs various functions and processes data by operating or executing software programs and/or modules stored in the memory 403 and calling data stored in the memory.
In one embodiment, the terminal device includes one or more processors 403, and one or more memories 405, one or more computer programs 401, wherein the one or more computer programs 401 are stored in the memory 405 and configured to be executed by the one or more processors 403, and the one or more computer programs 401 are configured to execute the reach Native service execution method of the application described in the above embodiment. The one or more processors 403 shown in fig. 4 are capable of executing and implementing the functions of the framework startup module 10, the service startup module 20 shown in fig. 3.
The terminal equipment provided by the embodiment of the application can be used for loading the React Native framework file of the application to initialize the React Native framework of the application in response to the starting of the application; acquiring a component list of the React Native service from the initialized React Native framework; responding to the starting of the appointed reach Native service, acquiring a service component file which has a dependency relationship with the appointed reach Native service from a component list of the reach Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed reach Native service. By providing a method for executing the applied React Native service as required, when the application is started, loading the React Native framework file of the application to initialize the React Native framework of the application, then obtaining the component list of the React Native service from the initialized React Native framework, compiling and executing the js code of the React Native framework, when the application is started to specify the React Native service, obtaining the service component file which has a dependency relationship with the specified React Native service from the component list of the React Native service, then compiling the js code of the service component file, obtaining the execution code of the service component, then loading the execution code to start the specified React Native service, the js codes of other React Native services which do not need to be started do not need compiling, separating the framework logic from the service logic of the application, and executing the service logic as required, and compiling and executing irrelevant js codes are reduced, so that the starting efficiency of the service needing to be started is improved.
The terminal device provided in the embodiment of the present application can implement the embodiment of the read Native service execution method of the application provided above, and for specific function implementation, reference is made to the description in the embodiment of the method, which is not described herein again.
The foregoing is only a few embodiments of the present application and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present application, and that these improvements and modifications should also be considered as the protection scope of the present application.
Claims (9)
1. A method for executing a React Native service of an application is characterized by comprising the following steps:
in response to the starting of the application, loading a React Native framework file of the application to initialize the React Native framework of the application; acquiring a component list of the React Native service from the initialized React Native framework;
responding to the starting of a specified real Native service, acquiring a service component file having a dependency relationship with the specified real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the specified real Native service, wherein the method comprises the following steps: and acquiring the priority of the service component files with the dependency relationship, sequentially analyzing the corresponding service component files according to the priority of the service component files, and acquiring the execution codes of the corresponding service components.
2. The method according to claim 1, wherein the real Native framework files and the real Native business component files of the application are packaged by a method comprising:
acquiring an entry file of an applied React Native framework, and packaging the entry file of the React Native framework through a packaging script to generate a React Native framework file;
acquiring an entry file of each read Native service; splitting and packaging the execution codes of the real Native services according to the entry files of the real Native services to generate real Native service component files based on the real Native framework;
and calculating the dependency relationship of each read Native service component file according to the entry files of the read Native services, and generating a component list of the read Native services.
3. The method according to claim 2, wherein the splitting and packaging the execution code of the real Native service according to the entry file of each real Native service to generate each real Native service component file based on the real Native framework comprises:
splitting the execution code of the real Native service into a real Native service component with the smallest unit according to the entry file of each real Native service;
allocating unique identification marks for the read Native service components of the minimum units;
and packaging the React Native service components of each minimum unit to generate React Native service component files based on the React Native framework.
4. The method according to claim 1, wherein the obtaining a service component file having a dependency relationship with a specified real Native service from a component list of the real Native service in response to the starting of the specified real Native service comprises:
responding to the starting of the appointed real Native service, and acquiring a request path of a service component file having a dependency relationship with the appointed real Native service from a component list of the real Native service;
and requesting a corresponding service component file from the server according to the request path.
5. The method according to claim 1, wherein the obtaining of the component list of the real Native service from the initialized real Native framework further comprises:
analyzing the real Native framework file according to a binary header protocol of the real Native framework file, and acquiring configuration information of a component list of the real Native service;
the analyzing the service component file to obtain the execution code of the service component comprises the following steps:
analyzing the service assembly file, calculating the starting position and the ending position of the execution code of the service assembly according to the configuration information, and determining the execution code of the service assembly.
6. A reach Native service execution device of an application, comprising:
a framework starting module: the real Native framework file is used for responding to the starting of the application and loading the real Native framework file of the application so as to initialize the real Native framework of the application; acquiring a component list of the React Native service from the initialized React Native framework;
a service starting module: the method is used for responding to the starting of the appointed real Native service, acquiring a service component file which has a dependency relationship with the appointed real Native service from a component list of the real Native service, analyzing the service component file to acquire an execution code of the service component, and executing the execution code to start the appointed real Native service, and comprises the following steps: and acquiring the priority of the service component files with the dependency relationship, sequentially analyzing the corresponding service component files according to the priority of the service component files, and acquiring the execution codes of the corresponding service components.
7. The apparatus of claim 6, wherein the service initiation module further performs:
responding to the starting of the appointed real Native service, and acquiring a request path of a service component file having a dependency relationship with the appointed real Native service from a component list of the real Native service;
and requesting the corresponding service component file from the server according to the request path.
8. A computer-readable storage medium, having a computer program stored thereon, which, when executed by a processor, implements the read Native service execution method of an application according to any one of claims 1 to 5.
9. A terminal device, comprising:
one or more processors;
a memory;
one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more computer programs configured to perform a read Native business execution method of an application according to any one of claims 1 to 5.
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 CN110442399A (en) | 2019-11-12 |
CN110442399B true 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) |
Families Citing this family (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 |
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 |
Family Cites Families (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1945530B (en) * | 2006-11-07 | 2010-05-12 | 中兴通讯股份有限公司 | Arranging system and method for module having dependence |
CN103810172B (en) * | 2012-11-06 | 2017-07-04 | 金蝶软件(中国)有限公司 | The method and apparatus of formation component dependence graph |
CN105138352B (en) * | 2015-07-31 | 2020-03-20 | 百度在线网络技术(北京)有限公司 | Method and device for installing application plug-in |
CN106843820B (en) * | 2015-12-04 | 2020-08-04 | 阿里巴巴集团控股有限公司 | Code processing method and device |
CN108512672B (en) * | 2017-02-24 | 2020-12-04 | 华为技术有限公司 | Service arranging method, service management method and device |
CN107168730B (en) * | 2017-04-14 | 2020-12-25 | 北京五八信息技术有限公司 | Application program loading method, server and terminal |
CN107861766B (en) * | 2017-06-26 | 2021-04-23 | 平安普惠企业管理有限公司 | Application starting method and device and computer readable storage 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 | 咪咕文化科技有限公司 | Method and device for providing service function and computer readable storage medium |
CN108845839B (en) * | 2018-05-31 | 2023-07-14 | 康键信息技术(深圳)有限公司 | Application page loading method and device and computer readable storage medium |
CN109189729B (en) * | 2018-09-03 | 2024-07-19 | 五八有限公司 | Method, device, equipment and storage medium for searching dependency relationship among components |
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 |
CN110007980B (en) * | 2019-01-29 | 2022-05-24 | 创新先进技术有限公司 | Method and device for realizing multi-service server |
-
2019
- 2019-08-09 CN CN201910736483.4A patent/CN110442399B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN110442399A (en) | 2019-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110442399B (en) | Method and device for executing read Native service of application, storage medium and terminal equipment | |
US10303490B2 (en) | Apparatus and method for optimizing startup of embedded system | |
US20120222019A1 (en) | Control Flow Graph Operating System Configuration | |
CN105490860A (en) | Method, device and system for deploying application program operation environment | |
US11216343B1 (en) | System and method for accelerating processing in event-driven server-less computing | |
CN111078229A (en) | Application processing method and device, storage medium and electronic equipment | |
CN114816417B (en) | Cross compiling method, device, computing equipment and storage medium | |
CN110659031A (en) | Compiling method and device of application program, electronic equipment and storage medium | |
CN115629971A (en) | Application development system and method | |
CN111459499A (en) | Program compiling method and device, computer storage medium and electronic equipment | |
CN111651169B (en) | Block chain intelligent contract operation method and system based on web container | |
US20140208309A1 (en) | Method, apparatus, and communication system for implementing internet application | |
CN111666102A (en) | File format conversion method, chip verification method, related device and network chip | |
CN118276884A (en) | Container packaging method, device, equipment and storage medium | |
CN114816424A (en) | Container-based continuous integration method and device and electronic equipment | |
CN103150161B (en) | Based on task encapsulation method and the device of MapReduce computation module | |
CN110928545A (en) | Component distribution method, single-page application development method, device and storage medium | |
CN112181388B (en) | Initializing method and device of SDK (software development kit) component, storage medium and control terminal | |
CN113127329B (en) | Script debugging method and device and computer storage medium | |
US9448782B1 (en) | Reducing a size of an application package | |
CN113434154A (en) | Android application packaging method and device, storage medium and electronic device | |
CN115543486B (en) | Server-free computing oriented cold start delay optimization method, device and equipment | |
CN112433816A (en) | Performance optimization method and device based on Javascript engine | |
CN111273916A (en) | Algorithmic heat deployment method, apparatus, computer system and medium | |
CN113672238B (en) | Operation method, device and equipment based on real-time operating system modularized management |
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 |