Page starting method and device
By relying on the configuration index table to determine the target execution elements and page identification elements required for the applet page, only the necessary elements are injected, which solves the problem of excessive time to start the applet page and waste of memory, and achieves rapid loading and resource optimization.
Patent Information
- Application Number
- CN202310738801.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2024-12-20
AI Technical Summary
When the applet page is started, all JS modules are injected at one time, which can take too long, affect the user experience, and unused code blocks cause memory waste.
By calling the subcontracted dependency configuration index table, determine the target execution elements and page identification elements required for the target page, inject only the necessary set of elements to achieve on-demand injection.
It reduces the amount of data injected at the page startup, reduces the startup time, and avoids the memory waste of excess data, improving page loading speed and user experience.
Smart Images

Figure CN119166226A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to a page startup method and device. Background Art
[0002] With the rapid development of the Internet, mini programs are widely used because they do not need to be downloaded, are easy to use, and do not occupy memory. The current startup process of mini programs usually involves downloading the subpackage where the page is located, injecting the subpackage JS module, creating the page, and rendering it. Among them, when entering the subpackage JS module injection process, all JS modules of the subpackage are aggregated into an executable file and injected at one time, which will cause the injection of the executable file to take too long, resulting in slow page startup and affecting the user experience. At the same time, code blocks that are not used by the current page will waste memory. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a page startup method and device to reduce the time consumption of page startup, improve the page loading speed, and avoid memory waste caused by redundant data.
[0004] In a first aspect, a page startup method is provided, the method comprising:
[0005] In response to receiving a start instruction of a target page, calling a dependency configuration index table of a subpackage to which the target page belongs, wherein the dependency configuration index table is used to record dependency relationships between nodes in the subpackage, wherein the nodes include page identification elements and execution elements;
[0006] Based on the dependency relationship, determining a target execution element required to load the target page;
[0007] An executable file including the page identification element and the target execution element is injected to load the target page.
[0008] In a second aspect, a page startup device is provided, the device comprising:
[0009] A calling module, configured to call a dependency configuration index table of a subpackage to which the target page belongs in response to receiving a start instruction of the target page, wherein the dependency configuration index table is used to record the dependency relationship between nodes in the subpackage, wherein the nodes include a page identification element and an execution element;
[0010] A determination module, used for determining a target execution element required to load the target page based on the dependency relationship;
[0011] The loading module is used to inject an executable file including the page identification element and the target execution element to load the target page.
[0012] According to a third aspect, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method according to the first aspect is implemented.
[0013] According to a fourth aspect, an electronic device is provided, the device comprising:
[0014] a memory for storing one or more computer program instructions;
[0015] A processor, wherein the one or more computer program instructions are executed by the processor to implement the method according to the first aspect.
[0016] In response to receiving the startup instruction of the target page, the method and device of the embodiment of the present invention call the dependency configuration index table of the subpackage to which the target page belongs, and the dependency configuration index table is used to record the dependency relationship between the nodes in the subpackage, and the nodes include page identification elements and execution elements. Then, based on the dependency relationship, the target execution element required to load the target page is determined, and finally, the executable file containing the page identification element and the target execution element is injected to load the target page. Therefore, when the page is started, only the minimum set of elements that ensure the normal startup of the current page is injected, so as to realize on-demand injection, reduce the amount of injected data when starting the page, reduce the time consumption of page startup, and avoid memory waste caused by redundant data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0018] Figure 1 A flow chart of a page startup method according to an embodiment of the present invention;
[0019] Figure 2 A flowchart of a method for configuring a dependency configuration index table according to an embodiment of the present invention;
[0020] Figure 3 A schematic diagram of a dependency directed graph according to an embodiment of the present invention;
[0021] Figure 4 A schematic diagram of a dependency configuration index table according to an embodiment of the present invention;
[0022] Figure 5 A schematic diagram of a single element of an embodiment of the present invention being merged into a single dependent execution element;
[0023] Figure 6 A schematic diagram of a dependency configuration index table and required memory according to an embodiment of the present invention;
[0024] Figure 7A schematic diagram of a page startup device according to an embodiment of the present invention;
[0025] Figure 8 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.
[0027] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.
[0028] Unless the context clearly requires otherwise, the words "include", "comprising" and similar words throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, the meaning is "including but not limited to".
[0029] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.
[0030] With the rapid development of the Internet, mini programs are widely used because of their advantages of no need to download, easy to use, and low memory usage. When a mini program page is started, all related components in the subpackage to which the page belongs will be loaded at the same time, and hundreds of controls need to be rendered, which requires a large amount of computer resources, greatly increasing the operating burden of mobile terminals and affecting the loading speed when the page starts. At the same time, the performance requirements of mobile terminals are not conducive to the use of mini programs on low-performance mobile terminals, thus affecting the user experience. Considering the efficiency of page startup and the wide application, it is necessary to find a method that is more suitable for page startup.
[0031] In the embodiment of the present invention, the mini-program page startup is mainly used as an example for illustration. It should be understood that the method of the embodiment of the present invention can be applied to any scenario that needs to speed up the page startup speed and reduce memory usage, and this embodiment is not limited to this.
[0032] Figure 1 Flow chart of the page startup method according to an embodiment of the present invention. Figure 1 As shown, the page startup method includes the following steps:
[0033] In step S101, in response to receiving a start instruction of a target page, a dependency configuration index table of a subpackage to which the target page belongs is called, wherein the dependency configuration index table is used to record dependency relationships between nodes in the subpackage, wherein the nodes include page identification elements and execution elements.
[0034] Among them, the target page can be understood as a page displayed according to the user's operation needs. When the user wants to view a page, opens the page of the mobile terminal or refreshes a page, the startup operation of the target page will be triggered, and the mobile terminal can generate the corresponding startup instruction according to the startup operation. Subpackaging refers to dividing a complete mini program project into different sub-packages according to needs, and dividing it into a main package and multiple sub-packages during construction, and the user loads it on demand when using it. When the mini program starts, the main package will be downloaded by default and the page in the main package will be started. When the user enters a page in the sub-package, the client will download the corresponding sub-package and render the corresponding page. A sub-package may include multiple pages and components or modules corresponding to the pages. A sub-package corresponds to a dependency configuration index table. The dependency configuration index table records the dependency relationship of all nodes in the corresponding sub-package. The node includes a page identification element and an execution element. The page identification element is the page, and the execution element is the module (module) and component (component) in the page. Module is used to encapsulate various methods of creating class instances. Component can also be called an injector, which is used to initialize the corresponding instance according to the module and inject the instance into the target class. A dependency relationship represents the connection between classes, meaning that one class depends on the definition of another class. The dependency relationship is unidirectional. Simply put, a dependency relationship means that a node needs to call another node when it starts, and the other node changes.
[0035] It is worth noting that different types of elements have different dependency scopes. As an entry file, a page can only depend on components and / or modules, and cannot be depended on by other elements. Components can depend on other components and / or modules. Modules can only depend on other modules.
[0036] In a possible implementation, the dependency configuration index table is pre-packaged in the configuration file corresponding to the sub-package. Specifically, each sub-package of the mini-program corresponds to a dependency configuration index table, and all dependency configuration index tables are pre-configured and packaged in the configuration file corresponding to the mini-program. The dependency configuration index table needs to be configured during the engine compilation phase of the mini-program.
[0037] Figure 2 FIG. 1 is a flow chart of a method for configuring a dependency configuration index table according to an embodiment of the present invention. Figure 2 As shown, the configuration method of the dependency configuration index table includes the following steps:
[0038] In step S210, the dependency relationship between the nodes in the sub-packet is determined.
[0039] In step S220, based on the dependency relationship of each of the nodes, the dependency configuration package corresponding to the node is determined.
[0040] In step S230, the dependency configuration index table is determined according to the dependency configuration package.
[0041] In a possible implementation, the dependency relationship of each node in the subpackage can be determined by keyword matching in step S210. Specifically, the keyword can be the identifier of each node, such as the node name or node number. For example, if node A depends on node B, the code corresponding to node A must include a statement indicating that node A depends on node B, that is, the identifier of node B will appear in the code corresponding to node A. Therefore, by querying the identifier of node B in the subpackage, node A that depends on node B can be found.
[0042] In a possible implementation, after the dependency relationship between the nodes in the sub-package is determined, a corresponding dependency directed graph may be created to facilitate more efficient creation of a dependency configuration index table.
[0043] Figure 3 FIG. 1 is a schematic diagram of a dependency directed graph according to an embodiment of the present invention. Figure 3 As shown, a subpackage includes two pages, page 1 and page 2. Page 1 depends on component 1, component 2 and module 1. Component 1 depends on module 1, and component 2 and module 1 have no other dependencies. Page 2 depends on component 1, component 3 and component 4. Component 1 depends on module 1, component 3 has no other dependencies, and component 4 depends on module 2.
[0044] After creating the above dependency directed graph, traverse the dependency directed graph to determine the configuration dependency package corresponding to each node in the graph, and record the dependency of the corresponding node in the configuration dependency package. Finally, package the dependency configuration packages corresponding to all nodes in the sub-package to form a dependency configuration index table.
[0045] Figure 4 Schematic diagram of the dependency configuration index table of an embodiment of the present invention. Taking the startup page as the starting point, traverse the above dependency directed graph to determine the dependency configuration package corresponding to each node, assuming that page 1 is the startup page. Figure 4 As shown, the dependencies of page 1 include component 1, component 2 and module 1. Therefore, the dependency configuration package 41 of page 1 specifies the node identifier, i.e., page1, and the dependencies of page 1, i.e., component 1 (Component1), component 2 (Component2) and module 1 (Module1). Then, according to Figure 3It is determined that component 1 has dependencies, so a dependency configuration package 42 corresponding to component 1 is created. The dependency configuration package 42 specifies the node identifier, namely, Component1, and the dependency of component 1, namely, module 1 (Module1).
[0046] Page 2's dependencies include component 1, component 3, and component 4. Therefore, the dependency configuration package 43 of page 2 specifies the node identifier, i.e., page2, and the dependencies of page 2, i.e., component 1 (Component1), component 3 (Component2), and module 4 (Module1). Figure 3 It is determined that the dependency of component 1 is module 1, component 3 has no dependency, and component 4 depends on module 2. Among them, the dependency configuration package 42 of component 1 has been created, so there is no need to repeatedly create the dependency configuration package corresponding to component 1. Create the dependency configuration package 44 corresponding to component 4, which contains the node identifier, namely Component4, and the dependency of component 4, namely module 2 (Module2).
[0047] Finally, the dependency configuration package 41, dependency configuration package 42, dependency configuration package 43 and dependency configuration package 44 are packaged to form a dependency configuration index table corresponding to the sub-packages of page 1 and page 2.
[0048] The above method creates a dependency configuration package for each node in the subpackage by traversing the dependency directed graph corresponding to the subpackage, which can avoid repeated configuration of the dependency configuration package of the same node and avoid wasting memory resources.
[0049] In a possible implementation, the node may include multiple execution elements. Step S220 may specifically be, in response to the node being an execution element, merging a single element into an execution element that depends on the single element based on the dependency relationship of each execution element. The single element is a single dependent execution element.
[0050] Figure 5 FIG. 1 is a schematic diagram of a single element of an embodiment of the present invention being merged into a single dependent execution element. Figure 5As shown, the dependency directed graph 51 is an initial dependency directed graph or a part of the initial dependency directed graph created according to the dependency relationship between each node. The dependency relationship in the dependency directed graph 51 is: execution element 1 depends on execution element 2, execution element 2 depends on execution element 3, execution element 3 depends on execution element 4 and execution element 5, and at the same time, execution element 4 is also dependent on execution element 6. Since execution element 2 is only dependent on execution element 1, execution element 2 is a single element, and execution element 2 can be incorporated into execution element 1 to form a merged combination element 1. In other words, during the injection process, after injecting execution element 1, execution element 2 must be injected, and no other execution element needs to depend on execution element 2. Incorporating execution element 2 into execution element 1 will not cause injection logic confusion. Therefore, execution element 2 can be incorporated into execution element 1 to form a merged combination element 1, so that the original execution element 1 and the original execution element 2 are injected together, reducing the dependency judgment in the injection process and speeding up the injection speed. Merged combination element 1 depends on execution element 3. Using the above method, it can be seen that execution element 3 is also a single element, and execution element 3 can also be incorporated into merged combination element 1. Thus, a dependency directed graph 52 can be obtained.
[0051] In the dependency directed graph 52, execution element 4 is dependent on execution element 1 and execution element 6. Therefore, execution element 4 is not a single element and cannot be incorporated into other execution elements, otherwise it will cause confusion in the injection logic. For example, if execution element 4 is incorporated into execution element 1, when execution element 6 is injected, it may not be able to find the dependent execution element 4, which will interrupt the injection process and affect the entire injection process. Execution element 5 is a single element of execution element 1, so execution element 5 can be incorporated into the merged combination element 1. Thus, a dependency directed graph 53 can be obtained. However, it is worth noting that incorporating execution element 5 into the merged combination element 1 is reasonable in the injection process and will not affect the injection of each node. However, it does not mean that execution element 5 will depend on execution element 4.
[0052] In step S102, based on the dependency relationship, a target execution element required to load the target page is determined.
[0053] Among them, the target execution element includes the page identification element corresponding to the target page, the execution element that the target page depends on, and the execution element that the execution element that the target page depends on depends on... until the execution element has no dependency, all the execution elements in this process belong to the target execution element required to load the target page.
[0054] In one possible implementation, a corresponding dependency directed graph is created according to the dependency configuration index table, and then the dependency directed graph is traversed to determine the target execution element required to load the target page. The traversal method of the dependency directed graph is depth-first traversal. Depth-first traversal refers to starting from the initial access node of the dependency directed graph. The initial access node may have multiple adjacent nodes. The strategy of depth-first traversal is to first visit the first adjacent node, and then use this visited adjacent node as the initial node to visit the first adjacent node of the initial node, and each time after visiting the current node, the first adjacent node of the current node is visited first. Depth-first traversal gives priority to digging vertically instead of horizontally visiting all adjacent nodes of a node. Obviously, deep directed search is a recursive process. With Figure 3 For example, if the target page is page 1, the directed graph corresponding to the target page is a directed graph consisting of page 1, component 1, component 2, and module 1. During the deep traversal search, start from page 1, determine the dependencies corresponding to page 1, select the adjacent node for access, that is, component 1, determine the dependencies corresponding to component 1, take component 1 as the initial node, select the adjacent node module 1 for access, determine that module 1 has no dependencies, then end the access to the branch where module 1 is located, and return to other branches of page 1, that is, component 2 for access. Until all nodes are visited.
[0055] In step S103, the page identification element and the target execution element are injected into an executable file to load the target page.
[0056] In a possible implementation, the page identification element and the target execution element corresponding to the target page are sequentially added to the injection queue corresponding to the target page, and then the executable file containing the injection queue is injected to load the target page. In other words, one page corresponds to one injection queue, and each node corresponding to the target page is sequentially injected into the injection queue of the target page according to the above access order. Among them, the state of the target execution element is not injected. After the target execution element is successfully injected, the state of the target execution element is modified to injected. Figure 5 For example, in the dependency directed graph 53, the states of execution element 6, execution element 1, and execution element 4 before injection are all not injected. After the injection starts, execution element 6 is injected first, and then execution element 4 of execution element 6 is injected. At this time, the state of execution element 4 is changed to injected. When execution element 1 is injected next, since the state of execution element 4 is injected, there is no need to inject execution element 4 again.
[0057] Figure 6 Schematic diagram of the dependency configuration index table and required memory of an embodiment of the present invention. Figure 6As shown, executable file diagram 61 is used to represent the executable file and required memory corresponding to the entire subpackage, executable file diagram 62 is used to represent the executable file and required memory corresponding to each page of the entire subpackage, executable file diagram 63 is used to represent the executable file and required memory corresponding to page 1, and executable file diagram 64 is used to represent the executable file and required memory corresponding to page 2. At present, when a page in a mini program is started, all pages, components and modules in the subpackage where the page is located are usually injected together, such as Figure 6 As shown in , the startup page 1 needs to inject the executable file containing all the elements in the entire sub-package. At this time, the size of the executable file is 900k. That is, the startup page 1 needs to inject a 900k executable file. Figure 3 The injection method of this embodiment is described.
[0058] If the user clicks or refreshes the target page, the target page is loaded. Specifically, the page identification element corresponding to the target page needs to be determined first, such as page 1 in the figure. Then, the dependency relationship of page 1 is determined from the dependency configuration index table according to the page identification element, and the dependency of page 1 is determined. Figure 3 and Figure 6 It can be seen that page 1 depends on component 1, component 2 and module 1. Use the depth-first traversal method to continue to search for the dependencies of component 1, component 2 and module 1. Component 1 depends on module 1, and component 2 has no dependency on module 1. Since page 1 and component 1 both depend on module 1, it is necessary to deduplicate module 1 and only keep one module 1. Therefore, starting page 1 requires injecting page 1, component 1, component 2 and module 1. Add page 1, component 1, component 2 and module 1 to the injection queue corresponding to page 1 in turn and wait for injection. After the injection is completed, the status of the injected page 1, component 1, component 2 and module 1 are all changed to injected to prevent unnecessary waste of resources caused by repeated injection. At this time, injecting page 1 only needs to load 100k of data.
[0059] If the user continues to operate, page 2 needs to be opened. The dependency relationship of the target page is determined from the dependency configuration index table. Figure 3It can be seen that page 2 depends on component 1, component 3 and component 4. Among them, component 1 has been loaded when page 1 is loaded, so the component 1 whose status is injected is removed, and there is no need to search for the dependency of component 1, saving search time. Component 3 has no dependencies, and component 4 depends on module 2. Module 2 has no dependencies. Therefore, starting page 2 requires injecting page 2, component 3, component 4 and module 2. Add page 2, component 3, component 4 and module 2 to the injection queue corresponding to page 2 in turn and wait for injection. After the injection is completed, the status of injected page 2, component 3, component 4 and module 2 are all modified to injected to prevent unnecessary waste of resources caused by repeated injection. At this time, injecting page 2 only needs to load 300k of data.
[0060] In summary, the method of this embodiment is used to start the page. The minimum set of data required to start each page can be accurately determined, and the data can be injected in batches through the injection queue corresponding to each page. When the page is started, only the data in the injection queue corresponding to the page can be injected, which effectively solves the problem of too long time consumption in the page startup phase, and of course also solves the problem of waste of redundant data memory in the startup phase.
[0061] The method of the embodiment of the present invention responds to receiving the startup instruction of the target page, calls the dependency configuration index table of the subpackage to which the target page belongs, and the dependency configuration index table is used to record the dependency relationship between the nodes in the subpackage, and the nodes include page identification elements and execution elements. Then, based on the dependency relationship, the target execution element required to load the target page is determined, and finally, the executable file containing the page identification element and the target execution element is injected to load the target page. Therefore, when the page is started, only the minimum set of elements that ensure the normal startup of the current page is injected, so as to realize on-demand injection, reduce the amount of injected data when starting the page, reduce the time consumption of page startup, and avoid memory waste caused by redundant data.
[0062] Figure 7 FIG. 1 is a schematic diagram of a page startup device according to an embodiment of the present invention. Figure 7 As shown, the page startup device includes the following modules:
[0063] The calling module 701 is used to call the dependency configuration index table of the subpackage to which the target page belongs in response to receiving the startup instruction of the target page, and the dependency configuration index table is used to record the dependency relationship between the nodes in the subpackage, and the nodes include page identification elements and execution elements.
[0064] The determination module 702 is used to determine the target execution element required to load the target page based on the dependency relationship.
[0065] The loading module 703 is used to inject the page identification element and the target execution element into the executable file to load the target page.
[0066] In response to receiving the startup instruction of the target page, the device of the embodiment of the present invention calls the dependency configuration index table of the subpackage to which the target page belongs, and the dependency configuration index table is used to record the dependency relationship between the nodes in the subpackage, and the nodes include page identification elements and execution elements. Then, based on the dependency relationship, the target execution element required to load the target page is determined, and finally, the executable file containing the page identification element and the target execution element is injected to load the target page. Therefore, when the page is started, only the minimum set of elements that ensure the normal startup of the current page is injected, so as to realize on-demand injection, reduce the amount of injected data when starting the page, reduce the time consumption of page startup, and avoid memory waste caused by redundant data.
[0067] Figure 8 Schematic diagram of an electronic device according to an embodiment of the present invention. Figure 8 As shown, Figure 8 The electronic device shown is a general address query device, which includes a general computer hardware structure, which at least includes a processor 81 and a memory 82. The processor 81 and the memory 82 are connected via a bus 83. The memory 82 is suitable for storing instructions or programs executable by the processor 81. The processor 81 can be an independent microprocessor or a collection of one or more microprocessors. Thus, the processor 81 executes the instructions stored in the memory 82, thereby executing the method flow of the embodiment of the present invention as described above to realize the processing of data and the control of other devices. The bus 83 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 84 and the display device and the input / output (I / O) device 85. The input / output (I / O) device 85 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices known in the art. Typically, the input / output device 85 is connected to the system via an input / output (I / O) controller 86.
[0068] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices (equipment) or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0069] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0070] The present application is described with reference to flowcharts of methods, apparatuses (devices) and computer program products according to embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.
[0071] These computer program instructions may be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device that implements the process Figure 1 A function specified in a process or multiple processes.
[0072] These computer program instructions may also be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce the instructions for implementing the process Figure 1 A device that specifies functions in a process or multiple processes.
[0073] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.
[0074] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by specifying relevant hardware through a program, and the program is stored in a storage medium, including several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0075] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A page startup method, characterized in that: The method comprises: In response to receiving a start instruction of a target page, calling a dependency configuration index table of a subpackage to which the target page belongs, wherein the dependency configuration index table is used to record dependency relationships between nodes in the subpackage, wherein the nodes include page identification elements and execution elements; Based on the dependency relationship, determining a target execution element required to load the target page; An executable file including the page identification element and the target execution element is injected to load the target page.
2. The method according to claim 1, characterized in that The dependency configuration index table is pre-packaged in the configuration file corresponding to the sub-package; The configuration method of the dependency configuration index table includes: Determining the dependency relationship between nodes in the sub-package; Based on the dependency relationship of each of the nodes, determining the dependency configuration package corresponding to the node; The dependency configuration index table is determined according to the dependency configuration package.
3. The method according to claim 2, characterized in that The node may include a plurality of execution elements; Determining the dependency relationship between the nodes in the sub-packet includes: In response to the node being an execution element, based on the dependency relationship of each of the execution elements, a single element is merged into the execution element that depends on the single element, and the single element is the single-dependent execution element.
4. The method according to claim 1, characterized in that: The step of determining the target execution element required to load the target page based on the dependency relationship includes: Creating a corresponding dependency directed graph according to the dependency configuration index table; The dependency directed graph is traversed to determine a target execution element required to load the target page.
5. The method according to claim 1, characterized in that The state of the target execution element is not loaded; The method further comprises: After the target execution element is injected successfully, the state of the target execution element is modified to loaded.
6. The method according to claim 1, characterized in that The injecting an executable file including the page identification element and the target execution element to load the target page includes: Adding the page identification element and the target execution element corresponding to the target page to the injection queue corresponding to the target page in sequence; The executable file including the injection queue is injected to load the target page.
7. The method according to claim 1, characterized in that The page identification element is a page, and the execution element includes a component and a module; The page depends on the component and / or the module, the component depends on other components and / or the module, and the module depends on other modules.
8. A page startup device, characterized in that: The device comprises: A calling module, configured to call a dependency configuration index table of a subpackage to which the target page belongs in response to receiving a start instruction of the target page, wherein the dependency configuration index table is used to record the dependency relationship between nodes in the subpackage, wherein the nodes include a page identification element and an execution element; A determination module, used for determining a target execution element required to load the target page based on the dependency relationship; The loading module is used to inject an executable file including the page identification element and the target execution element to load the target page.
9. A computer-readable storage medium storing computer program instructions, characterized in that: The computer program instructions implement the method according to any one of claims 1 to 7 when executed by a processor.
10. An electronic device, characterized in that: The device comprises: a memory for storing one or more computer program instructions; A processor, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 7.
