A micro-front-end communication method, communication device, terminal equipment and storage medium
By introducing a message module and a cache management mechanism into the micro-frontend communication framework, the problems of poor communication between the main application and sub-applications and cache loss are solved, achieving efficient and accurate micro-frontend communication and cache management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI FUPEI TECHNOLOGY CO LTD
- Filing Date
- 2022-06-17
- Publication Date
- 2026-05-19
AI Technical Summary
Existing micro-frontend management systems suffer from problems such as poor communication between the main application and sub-applications, browser history issues, and limited sub-application operations. Furthermore, they are prone to cache loss after switching sub-application modules.
A micro-frontend communication framework is adopted, which enables precise communication between the main application module and the sub-application modules. This includes message database management and caching to ensure the accuracy of communication and the integrity of caching.
It achieves efficient and accurate communication between the main application module and the sub-application modules, avoids communication interference, and solves the problem of cache loss after switching sub-application modules, thereby improving the stability and efficiency of the system.
Smart Images

Figure CN115185708B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to, but is not limited to, the field of computer technology, and in particular to a micro-frontend communication method, communication device, terminal equipment, and storage medium. Background Technology
[0002] Currently, most mainstream micro-frontend management systems use older embedded frameworks (iframes) to build frontend micro-applications, but these still have many drawbacks, such as communication between the main application and sub-applications, browser history issues, and limited sub-application operations. In recent years, with the improvement and stable development of backend microservice mechanisms, frontend microservice solutions have also been continuously improved and refined. From the integration of older embedded frameworks (iframes) into external systems to the gradual deployment of micro-frontend frameworks, the infrastructure for frontend microservices is becoming increasingly robust. With the promotion and improvement of enterprise informatization, the demand for iterative information systems is becoming more frequent, and enterprises are increasingly clearly defining their business segments, avoiding mutual interference between different business units. Therefore, enterprises are increasingly demanding and requiring more stringent frontend and backend microservice architectures.
[0003] Therefore, there is no suitable communication method for micro-frontends in the existing technology. Summary of the Invention
[0004] This disclosure provides a communication method, communication device, terminal equipment, and storage medium for a micro-frontend, to enable communication between the main application module and sub-application modules in a micro-frontend.
[0005] In a first aspect, this disclosure provides a micro-frontend communication method, comprising: receiving a first message sent by a first sub-application module through a first message module, the first message module being used for communication between a main application module and the first sub-application module; parsing the first message to obtain an executable command corresponding to the first message; and executing the executable command.
[0006] In some possible implementations, before receiving the first message sent by the first sub-application module through the first message module, the method further includes: mounting the first sub-application module; and passing the first message module to the first sub-application module.
[0007] In some possible implementations, after receiving the first message sent by the first sub-application module through the first message module, the method further includes: parsing the first message to determine the second sub-application module; calling the second message module of the second sub-application module, the second message module being used for communication between the second sub-application module and the main application module; and sending the first message to the second sub-application module through the second message module.
[0008] In some possible implementations, before receiving the first message sent by the first sub-application module through the first message module, the method further includes: mounting the second sub-application module; receiving the second message module transmitted by the second sub-application module; and saving the second message module.
[0009] In some possible implementations, the main application module includes a sub-application module message module repository; saving the second message module includes: saving the second message module to the sub-application module message module repository.
[0010] In some possible implementations, the executable command is a cache query instruction; executing the executable command includes: executing the cache query instruction to query the cached data of the first sub-application module in the cache library of the sub-application module of the main application module; when the cached data is found, calling the third message module and sending the cached data to the first sub-application module through the third message module, the third message module being used for communication between the first sub-application module and the main application module.
[0011] In some possible implementations, after executing the cache query instruction and querying the cached data of the first sub-application module in the cache library of the sub-application module of the main application module, the method further includes: when no cached data is found, calling the third message module and sending a third message to the first sub-application module through the third message module, the third message being used to instruct the first sub-application module to perform cache initialization.
[0012] In some possible implementations, the executable command is a caching instruction; executing the executable command includes: executing the caching instruction to store the cached data of the first sub-application module into the sub-application module cache library of the main application module.
[0013] Secondly, this disclosure provides a micro-frontend communication method, including: obtaining a first message; calling a first message module, the first message module being used for communication between a main application module and a first sub-application module; and sending the first message to the main application module through the first message module.
[0014] In some possible implementations, before invoking the first message module, the method further includes: receiving the first message module passed by the main application module when the first sub-application module is mounted.
[0015] In some possible implementations, before invoking the first message module, the method further includes: when the first sub-application module is mounted, sending a third message module to the main application module, the third message module being used for communication between the first sub-application module and the main application module.
[0016] In some possible implementations, the executable command corresponding to the first message is a cache query instruction, which is used to instruct the main application module to query the cached data of the first sub-application module; the method also includes: receiving the cached data sent by the main application module through the third message module; loading the cached data; and rendering the page based on the cached data.
[0017] In some possible implementations, the method includes: receiving a third message sent by a first sub-application module through a third message module; parsing the third message to obtain a cache initialization instruction; executing the cache initialization instruction to initialize the cache; and rendering the page based on the initialized cache data.
[0018] In some possible implementations, the method further includes: determining that the application state of the first sub-application module is active; obtaining the cached data of the first sub-application module; and destroying the cached data.
[0019] In some possible implementations, obtaining the first message includes: generating a first message based on cached data, the first message being used to instruct the main application module to cache the cached data.
[0020] In some possible implementations, the method further includes: receiving a fourth message sent by the main application module through a third message module, the fourth message being used to instruct the closing of the page corresponding to the first sub-application module; parsing the fourth message to obtain a cache clearing instruction; and executing the cache clearing instruction to destroy the cache data of the first sub-application module.
[0021] In some possible implementations, the method further includes: setting the application state of the first sub-application module to an active state when the first sub-application module is mounted; or setting the application state of the first sub-application module to a destroyed state when the first sub-application module is unmounted.
[0022] Thirdly, this disclosure provides a micro-frontend communication device, which can be a chip or system-on-a-chip in a terminal device, or a functional module in the terminal device for implementing the method described in the first aspect and any possible implementation thereof. This micro-frontend communication device can implement the functions performed by the terminal device described in the first aspect and any possible implementation thereof, and these functions can be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions. The micro-frontend communication device includes: a receiving module for receiving a first message sent by a first sub-application module, the first message module being used for communication between the main application module and the first sub-application module; a message execution module for parsing the first message to obtain an executable command corresponding to the first message; and executing the executable command.
[0023] In some possible implementations, the apparatus further includes: a mounting module for mounting the first sub-application module; and a sending module for transmitting the first message module to the first sub-application module.
[0024] In some possible implementations, the apparatus further includes: a message execution module for parsing a first message and determining a second sub-application module; a second message module for invoking the second sub-application module, the second message module being used for communication between the second sub-application module and the main application module; and a sending module for sending the first message to the second sub-application module through the second message module.
[0025] In some possible implementations, the mounting module is also used to mount the second sub-application module; the receiving module is also used to receive the second message module transmitted by the second sub-application module; and the message execution module is used to save the second message module.
[0026] In some possible implementations, the main application module includes a sub-application module message module repository; the message execution module is also used to save the second message module to the sub-application module message module repository.
[0027] In some possible implementations, the executable command is a cache query instruction; the message execution module is used to execute the cache query instruction and query the cached data of the first sub-application module in the cache library of the sub-application module of the main application module; when the cached data is found, the third message module is called and the cached data is sent to the first sub-application module through the third message module. The third message module is used for communication between the first sub-application module and the main application module.
[0028] In some possible implementations, the message execution module is also used to call the third message module when no cached data is found, and send a third message to the first sub-application module through the third message module. The third message is used to instruct the first sub-application module to perform cache initialization.
[0029] In some possible implementations, the executable command is a cache instruction; the message execution module is used to execute the cache instruction and store the cached data of the first sub-application module into the sub-application module cache library of the main application module.
[0030] Fourthly, this disclosure provides a micro-frontend communication device. This device can be a chip or system-on-a-chip in a terminal device, or a functional module in the terminal device for implementing the method described in the first aspect and any possible implementation thereof. This micro-frontend communication device can implement the functions performed by the terminal device described in the first aspect and any possible implementation thereof, and these functions can be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions. The micro-frontend communication device includes: a message execution module for obtaining a first message; a first message module for communication between a main application module and a first sub-application module; and a sending module for sending the first message to the main application module.
[0031] In some possible implementations, the message execution module is also configured to receive the first message module transmitted by the main application module when the first sub-application module is mounted.
[0032] In some possible implementations, the sending module is also used to send a third message module to the main application module when the first sub-application module is mounted. The third message module is used for communication between the first sub-application module and the main application module.
[0033] In some possible implementations, the executable command corresponding to the first message is a cache query instruction, which is used to instruct the main application module to query the cached data of the first sub-application module; the message execution module is also used to receive the cached data sent by the main application module through the third message module; load the cached data, and perform page rendering based on the cached data.
[0034] In some possible implementations, the message execution module is further configured to receive a third message sent by the first sub-application module through the third message module; parse the third message to obtain a cache initialization instruction; execute the cache initialization instruction to initialize the cache; and render the page based on the initialized cache data.
[0035] In some possible implementations, the message execution module is further configured to determine that the application state of the first sub-application module is active; obtain the cached data of the first sub-application module; and the destruction module is configured to destroy the cached data.
[0036] In some possible implementations, the message execution module is also configured to generate a first message based on the cached data, the first message being used to instruct the main application module to cache the cached data.
[0037] In some possible implementations, the message execution module is further configured to receive a fourth message sent by the main application module through a third message module, the fourth message being used to instruct the closing of the page corresponding to the first sub-application module; parse the fourth message to obtain a cache clearing instruction; and the destruction module is configured to execute the cache clearing instruction to destroy the cached data of the first sub-application module.
[0038] In some possible implementations, the message execution module is further configured to set the application state of the first sub-application module to an active state when the first sub-application module is mounted; or to set the application state of the first sub-application module to a destroyed state when the first sub-application module is unmounted.
[0039] Fifthly, this disclosure provides a terminal device, comprising: a memory storing computer-executable instructions; and a processor connected to the memory, configured to execute the computer-executable instructions to implement the methods described in the first aspect, the second aspect, and any possible embodiments thereof.
[0040] In a sixth aspect, this disclosure provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, enable the implementation of the methods described in the first aspect, the second aspect, and any possible embodiments thereof.
[0041] The advantages of the technical solution provided in this disclosure compared with the prior art are as follows:
[0042] In this disclosure, the first message module receives the first message sent by the first sub-application module, parses the first message to obtain the executable command corresponding to the first message, and executes the executable command. In this way, communication between the main application module and the sub-application module is realized by executing the executable command corresponding to the parsed first message.
[0043] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit the scope of protection of this disclosure. Attached Figure Description
[0044] Figure 1 This is a schematic diagram of the micro-frontend communication framework in an embodiment of this disclosure;
[0045] Figure 2 This is a schematic diagram of the first implementation process of the micro-frontend communication method in this disclosure;
[0046] Figure 3 This is a schematic diagram of a second implementation of the communication method of the micro-frontend in this disclosure.
[0047] Figure 4This is a schematic diagram of a third implementation process of the micro-frontend communication method in this disclosure;
[0048] Figure 5 This is a schematic diagram of the fourth implementation process of the micro-frontend communication method in this disclosure;
[0049] Figure 6 This is a schematic diagram of the fifth implementation process of the micro-frontend communication method in this disclosure;
[0050] Figure 7 This is a schematic diagram of the sixth implementation process of the micro-frontend communication method in this disclosure;
[0051] Figure 8 This is a schematic diagram of the seventh implementation process of the micro-frontend communication method in this disclosure;
[0052] Figure 9 This is a schematic diagram of the eighth implementation process of the micro-frontend communication method in this disclosure;
[0053] Figure 10 This is a schematic diagram of the ninth implementation process of the micro-frontend communication method in this disclosure;
[0054] Figure 11 This is a schematic diagram of the tenth implementation of the communication method of the micro-frontend in this disclosure;
[0055] Figure 12 This is a schematic diagram of the micro front-end communication device in an embodiment of this disclosure;
[0056] Figure 13 This is another structural schematic diagram of the micro front-end communication device in the embodiments of this disclosure;
[0057] Figure 14 This is a schematic diagram of the structure of a terminal device according to an embodiment of this disclosure. Detailed Implementation
[0058] In the following description, reference is made to the accompanying drawings, which form part of this disclosure and illustrate specific aspects of embodiments of this disclosure or from which specific aspects of embodiments of this disclosure may be used. It should be understood that embodiments of this disclosure may be used in other aspects and may include structural or logical variations not depicted in the drawings. Therefore, the following detailed description should not be construed in a limiting sense, and the scope of this disclosure is defined by the appended claims. For example, it should be understood that the disclosure in connection with the described methods is equally applicable to corresponding devices or apparatuses for performing the methods, and vice versa. For example, if one or more specific method steps are described, the corresponding device may include one or more units, such as functional units, to perform the described one or more method steps (e.g., one unit performs one or more steps, or multiple units, each performing one or more of the multiple steps), even if such one or more units are not explicitly described or illustrated in the drawings. On the other hand, for example, if a specific apparatus is described based on one or more units, such as functional units, the corresponding method may include a step to perform the functionality of one or more units (e.g., one step performs the functionality of one or more units, or multiple steps, each performing the functionality of one or more of the multiple units), even if such one or more steps are not explicitly described or illustrated in the drawings. Furthermore, it should be understood that, unless otherwise expressly stated, the features of the various exemplary embodiments and / or aspects described herein may be combined with each other.
[0059] With the development and improvement of micro-frontend technology, fewer and fewer people are using embedded frameworks to build micro-frontends. Emerging micro-frontends often use single-spa, qiankun, and wujie. Using this approach presents two main problems: First, the main application module and sub-application modules communicate in a full-scale communication mode, sharing a single message library. Messages in this library are not actively deleted, which can easily cause communication interference. This communication method is suitable for full initialization information transmission but not for precise communication between the main and sub-application modules. Second, there is the issue of cache loss due to the destruction of sub-application modules after switching or switching.
[0060] To address the aforementioned issues, this disclosure provides a schematic diagram of a micro-frontend communication framework, see [link / reference]. Figure 1 As shown.
[0061] The micro-frontend communication framework consists of a main application module and corresponding business sub-application modules, with the main application module managing the sub-application modules. The micro-frontend communication framework 1 includes a main application module 100, multiple sub-application modules (such as sub-application module 200 and sub-application module 300), and a sub-application message module repository 400. In this embodiment, the main application module 100 includes a main application message repository 110, a main application command execution layer 120, and a main application message module 130; the sub-application module 200 includes a sub-application message repository 210, a sub-application command execution layer 220, and a sub-application message module 230; and the sub-application module 300 includes a sub-application message repository 310, a sub-application command execution layer 320, and a sub-application message module 330. The main application message library 110 stores messages received and / or sent by the main application module 100, the main application execution command layer 120 executes the obtained executable commands, and the main application message module 130 communicates with the sub-application modules; the sub-application message library 210 stores messages received and / or sent by the sub-application module 200, the sub-application execution command layer 220 executes the obtained executable commands, and the sub-application message module 230 communicates with the main application module; the sub-application message library 310 stores messages received and / or sent by the sub-application module 300, the sub-application execution command layer 320 executes the obtained executable commands, and the sub-application message module 330 communicates with the main application module; and the sub-application message module repository 400 stores sub-application message modules.
[0062] As is understandable, each sub-application module is a front-end application. Each sub-application module can run, be developed, and deployed independently. Each sub-application module can be deployed on the same server or on different servers, and can be on any server within the same network as the main application module. For example, a micro-application of software A can be considered a sub-application module, typically used on mobile devices. The corresponding main application module is software A. The micro-application depends on software A to run, and users need to invoke the micro-application through the interface of software A to meet various needs, such as communication, cache lookup, and caching.
[0063] The communication method provided in the embodiments of this disclosure will be described below in conjunction with the micro-frontend communication framework described above.
[0064] The communication method provided in this embodiment can be applied to the main application execution command layer 120 in the micro-frontend communication framework described above.
[0065] Figure 2 This is a schematic diagram of the first implementation flow of the micro-frontend communication method in this disclosure embodiment. See also... Figure 2 As shown, the communication method of this micro-frontend may include:
[0066] S201, receive the first message sent by the first sub-application module through the first message module.
[0067] The first message module is used for communication between the main application module and the first sub-application module. Of course, the first message can be received after communication is established between the main application module and the first sub-application module, and it can also be obtained through other means; this embodiment does not specifically limit this.
[0068] Understandably, the main application module and the first sub-application module in the micro-frontend communication device establish communication through the first message module. After the main application module and the first sub-application module establish communication, the micro-frontend communication device can receive the first message sent by the first sub-application module through the first message module.
[0069] In some possible implementations, the main application module can be software A for instant messaging, software B for payment, or software C for video browsing, etc.; the sub-application modules can be understood as a series of functional programs on software A, typically such as a ride-hailing program, a health code program, a shopping program, etc.; they can also be understood as a series of functional programs on software B, typically such as a package pickup program, a convenience service program, a second-hand trading program, etc.; and they can also be understood as a series of functional programs on software C, typically such as a game program, a shopping program, etc. Of course, the main application module and sub-application modules can also be determined in other ways, and this disclosure does not specifically limit them.
[0070] In some possible implementations, the first message may include two parts: a message header and a message body. The message header contains the identifier of the message executor and the execution information corresponding to the first message, while the message body is the executable command being transmitted. The first message is transmitted as a parameter of an executable command. An executable command is defined as an executable JavaScript function with a fixed parameter of one, which is the first message of the communication.
[0071] S202, parse the first message to obtain the executable command corresponding to the first message.
[0072] Understandably, after receiving the first message, the micro-frontend communication device parses the message header and message body of the first message to determine the executable command corresponding to the message body of the first message. The executable command can be a cache query instruction, a cache instruction, or an instruction of other types or contents; this embodiment does not specifically limit its nature.
[0073] S203, execute executable commands.
[0074] Understandably, after receiving the executable command corresponding to the first message, the micro-front-end communication device first confirms the specific content of the executable command based on the executable command transmitted in the message body of the first message, and then executes the executable command.
[0075] It should be noted that the micro-frontend communication device can execute the parsed executable commands within a set execution time period. That is, in the micro-frontend communication device, when the main application module receives a message from a sub-application module, it automatically triggers a parsing instruction to obtain the executable command corresponding to the parsed message and begins executing the executable command. Before executing the executable command, the micro-frontend communication device can receive a command waiting to be executed from the first sub-application module; this is the executable command. In this case, the executable command can also be understood as a command to be executed.
[0076] Therefore, in this embodiment of the disclosure, by receiving the first message sent by the first sub-application module through the first message module, parsing the first message to obtain the executable command corresponding to the first message, and executing the executable command, communication between the main application module and the sub-application module can be realized.
[0077] In some possible implementations, the micro-front-end communication device needs to execute S301 to S302 before executing S201 to S203. Specifically, Figure 3 This is a schematic diagram of a second implementation of the communication method of the micro-frontend in this disclosure. See also... Figure 3 As shown, S201 to S203 are executed before S301 to S302.
[0078] S301, mounts the first sub-application module.
[0079] Understandably, before receiving the first message sent by the first sub-application module, the micro-frontend communication device needs to mount the first sub-application module when establishing a connection between the main application module and the first sub-application module. This facilitates the exchange of message modules between the main application module and the first sub-application module, ensuring that the main application module and the first sub-application module can hold each other's message modules and communicate accurately and conveniently through the message modules.
[0080] S302, the first message module is passed to the first sub-application module.
[0081] Understandably, after the micro-frontend communication device mounts the first sub-application module, it passes the first message module, used for communication between the main application module and the first sub-application module, to the first sub-application module. In S201 above, the main application module receives the message module from the first sub-application module, and in S302, the first sub-application module receives the message module from the main application module. At this point, the mutual exchange of message modules between the main application module and the first sub-application module is completed, and the main application module and the first sub-application module achieve communication based on holding each other's message modules.
[0082] In some possible implementations, after executing S201 to S203, that is, after the micro-frontend communication device realizes communication between the main application module and the first sub-application module, it can also realize communication between the first sub-application module and the second sub-application module; that is, it also needs to execute S401 to S403. Specifically, Figure 4 This is a schematic diagram of a third implementation flow of the micro-frontend communication method in this disclosure embodiment. See also... Figure 4 As shown, after executing S201 to S203, S401 to S403 are executed.
[0083] S401, parse the first message and determine the second sub-application module.
[0084] Understandably, when parsing the first message, the micro-frontend communication device needs to parse the message header of the first message. That is, it needs to parse the identifier information of the message executor contained in the message header of the first message in order to determine the sub-application module corresponding to the message, that is, to determine the second sub-application module.
[0085] For example, the identification information is a unique identifier corresponding to each sub-application module. Here, the identification information can be pre-defined. The setting method can be as follows: if the current main application module needs to communicate with 6 sub-application modules, then 6 distinct identifiers can be automatically generated using rules. When the main application module attaches each sub-application module, it assigns the corresponding identifier to each sub-application module. The assignment rule can be random or sequential; this application does not specifically limit this. Of course, identifiers that have already been assigned will not be assigned to other sub-application modules, thus ensuring that the corresponding identification information assigned to each sub-application module is unique, that is, the identification information corresponding to each sub-application module under the main application module is all different.
[0086] S402, calls the second message module of the second sub-application module.
[0087] The second message module is used for communication between the second sub-application module and the main application module.
[0088] Understandably, in the above S401, after the second sub-application module is determined by parsing the first message, the micro-front-end communication device realizes the communication process with the main application module by calling the second message module of the second sub-application module.
[0089] S403, the first message is sent to the second sub-application module through the second message module.
[0090] Understandably, the micro-frontend communication device sends the first message sent by the first sub-application module to the second sub-application module through the second message module, thereby realizing communication between the first and second sub-application modules.
[0091] It should be noted that the first sub-application module can communicate with other sub-application modules through the message modules of the other sub-application modules.
[0092] Therefore, in this embodiment of the disclosure, by parsing the first message, the second sub-application module is determined; the second message module of the second sub-application module is called, and the second message module is used for communication between the second sub-application module and the main application module. By sending the first message to the second sub-application module through the second message module, communication between the sub-application modules can be realized.
[0093] In some possible implementations, the micro-front-end communication device needs to execute S501 to S503 before executing S401 to S403 described above. Specifically, Figure 5 This is a schematic diagram of the fourth implementation process of the micro-frontend communication method in this disclosure. See also... Figure 5 As shown, S501 to S503 are executed before S401 to S403 are executed.
[0094] S501, mounts the second sub-application module.
[0095] Understandably, before the micro-frontend communication device sends the first message to the second sub-application module, when the second sub-application module and the first sub-application module establish a connection, the main application module needs to mount the second sub-application module to facilitate the exchange of message modules between the second and first sub-application modules. This ensures that the second and first sub-application modules can hold each other's message modules and can communicate accurately and conveniently through the message modules.
[0096] S502, the module that receives the second message transmitted by the second sub-application module.
[0097] Understandably, in order to enable communication between the first sub-application module and the second sub-application module, the main application module needs to receive the second message module transmitted by the second sub-application module. This message module is used to establish communication between the second sub-application module and the main application module. Then, based on this, the first and second sub-application modules can communicate by relying on their corresponding message modules.
[0098] S503, save the second message module.
[0099] Understandably, after receiving the second message module from the second sub-application module, the main application module will save the second message module for subsequent communication.
[0100] In some possible implementations, the main application module includes a sub-application module message module repository, and the above-mentioned S503 may include: saving the second message module to the sub-application module message module repository.
[0101] In some possible implementations, the executable command during S203 can be a cache query instruction. The micro-front-end communication device may also include S601 to S602 during S203. Specifically, Figure 6 This is a schematic diagram of the fifth implementation flow of the micro-frontend communication method in this disclosure. See also... Figure 6 As shown, when executing S203, it may include S601 to S603.
[0102] S601, execute the cache query instruction to query the cache data of the first sub-application module in the cache library of the sub-application module of the main application module.
[0103] Understandably, when the micro-frontend communication device executes a cache query instruction, it needs to query the cache data of the first sub-application module in the cache library of the sub-application module of the main application module in order to determine whether the first sub-application module needs to be cached and initialized.
[0104] S602, when cached data is found, the third message module is called, and the cached data is sent to the first sub-application module through the third message module.
[0105] Here, the third message module is used for communication between the first sub-application module and the main application module.
[0106] Understandably, when the micro-frontend communication device retrieves cached data from the first sub-application module, it can directly use that cached data. Simultaneously, the main application module calls the third message module to send the retrieved cached data to the first sub-application module.
[0107] The third message module is used for communication between the first sub-application module and the main application module.
[0108] Of course, when querying the cache, the above S601 may also include: S603, when no cached data is found, calling the third message module and sending a third message to the first sub-application module through the third message module. The third message is used to instruct the first sub-application module to perform cache initialization.
[0109] Understandably, when the micro-frontend communication device does not find the cached data of the first sub-application module, the main application module calls the third message module to send a message to the first sub-application module to perform normal cache initialization. In other words, the first sub-application module needs to undergo normal cache initialization processing.
[0110] In this example, the cache initialization operation described above can be implemented by overriding the `created` method of `keep-alive`. Of course, cache initialization can also be performed in other ways, and this embodiment does not specifically limit this approach.
[0111] In some possible implementations, the executable command during S203 may be a cache instruction. When the micro-frontend communication device executes S203, it may include: executing a cache instruction to store the cached data of the first sub-application module into the sub-application module cache library of the main application module.
[0112] Understandably, when the executable command parsed by the micro-frontend communication device is a cache instruction, the main application module stores the cached data of the first sub-application module in the cache library of the main application module to facilitate caching between sub-application modules.
[0113] So, Figure 7 This is a schematic diagram of the sixth implementation process of the micro-frontend communication method in this disclosure. See also... Figure 6 As shown, the communication method of this micro-frontend may include:
[0114] S701, received the first message.
[0115] Understandably, after the execution time set by the micro-frontend communication device is reached, the first message is obtained. The first message is used to indicate the communication between the first message module and the main application module.
[0116] S702, calls the first message module.
[0117] Understandably, after receiving the first message, the micro-frontend communication device invokes the first message module. This first message module is used for communication between the main application module and the first sub-application module.
[0118] S703 sends the first message to the main application module through the first message module.
[0119] Understandably, the micro-frontend communication device sends the first message obtained by S701 to the main application module by calling the first message module, thereby realizing communication between the first sub-application module and the main application module.
[0120] The first message module is used for communication between the main application module and the first sub-application module.
[0121] In some possible implementations, the micro-front-end communication device may further include steps S801 to S802 before executing S701 to S703 described above. Specifically, Figure 8 This is a schematic diagram of the seventh implementation process of the micro-frontend communication method in this disclosure. See also... Figure 8 As shown, S701 to S703 are executed before S801 to S802.
[0122] S801, when the first sub-application module is mounted, receives the first message module transmitted by the main application module.
[0123] Understandably, when the micro-frontend communication device attaches the first sub-application module, the first sub-application module receives the message module of the main application module. At this time, the message modules of the first sub-application module exchange with each other, and the main application module and the first sub-application module achieve communication based on holding each other's message modules.
[0124] S802, when the first sub-application module is mounted, sends the third message module to the main application module.
[0125] Here, the third message module is used for communication between the first sub-application module and the main application module.
[0126] Understandably, when the micro-frontend communication device mounts the first sub-application module, the first sub-application module needs to send the third message module to the main application module. At this time, the third message module is used to implement the caching function of the first sub-application module.
[0127] In some possible implementations, when the executable command corresponding to the first message sent to the main application module after executing S703 is a cache query instruction, it may further include S901 to S902. Specifically, Figure 9 This is a schematic diagram of the eighth implementation process of the micro-frontend communication method in this disclosure. See also... Figure 9 As shown, executing S703 may include S901 to S902. Here, the cache query instruction is used to instruct the main application module to query the cached data of the first sub-application module.
[0128] S901 receives cached data sent by the main application module through the third message module.
[0129] Understandably, the micro-frontend communication device receives cached data sent by the main application module through the third message module, thereby realizing the caching function between sub-application modules.
[0130] S902 loads cached data and renders the page based on the cached data.
[0131] Understandably, the micro-frontend communication device loads the received cached data and renders the corresponding sub-application modules based on the cached data.
[0132] In some possible implementations, performing S902 may further include S1001 to S1004. Specifically, Figure 10 This is a schematic diagram of the ninth implementation process of the micro-frontend communication method in this disclosure. See also... Figure 10 As shown, when executing S903, it may include S1001 to S1004.
[0133] S1001, receive the third message sent by the first sub-application module through the third message module.
[0134] Understandably, before rendering the page, the micro-frontend communication device needs to receive a third message sent by the first sub-application module through the third message module.
[0135] S1002, parse the third message to obtain the cache initialization instruction.
[0136] Understandably, after receiving the third message, the micro-frontend communication device parses the message header and message body of the third message to determine that the executable command corresponding to the message body of the third message is a cache initialization instruction.
[0137] S1003, execute the cache initialization instruction to initialize the cache.
[0138] Understandably, the micro-frontend communication device initializes the cache of the first sub-application module according to the received cache initialization instruction, thereby obtaining the cache data of the first sub-application module.
[0139] S1004, render the page based on the initialized cached data.
[0140] Therefore, in this embodiment of the disclosure, the third message sent by the first sub-application module is received by the third message module, the third message is parsed, and the executable command is obtained as a cache initialization instruction. In this way, the data of the sub-application module can be cached, and the page of the sub-application module can be rendered according to the cached data after initialization.
[0141] In some possible implementations, when performing S901 above, the method may further include: determining that the application state of the first sub-application module is active; obtaining the cached data of the first sub-application module; and destroying the cached data according to the active state.
[0142] Understandably, when the micro-frontend communication device obtains cached data, it needs to consider the state of the first sub-application module to decide whether to destroy the cached data. When it is determined that the application state of the first sub-application module is active, the obtained cached data of the first sub-application module will be destroyed. The active state indicates that the first sub-application module is being accessed by the user and / or the main application module.
[0143] In some possible implementations, the above S701 may include: generating a first message based on cached data.
[0144] Here, the first message is used to instruct the main application module to cache the cached data.
[0145] Understandably, the micro-frontend communication device can generate a message for cached data based on the cached data of the first sub-application module.
[0146] In some possible implementations, after executing S701, it is also necessary to execute S1101 to S1103. Specifically, Figure 11 This is a schematic diagram of the tenth implementation of the communication method of the micro-frontend in this disclosure. See also... Figure 11 As shown, when executing S703, it may include S1101 to S1103.
[0147] S1101, receives the fourth message sent by the main application module through the third message module.
[0148] Understandably, before closing the page, the micro-frontend communication device needs to receive a fourth message sent by the main application module through the third message module.
[0149] Here, the fourth message is used to instruct the page corresponding to the first sub-application module to be closed.
[0150] S1102, parse the fourth message to obtain the cache clearing instruction.
[0151] Understandably, after receiving the fourth message, the micro-frontend communication device parses the message header and message body of the fourth message to determine that the executable command corresponding to the message body of the fourth message is a cache clearing instruction.
[0152] S1103, execute the cache cleanup command to destroy the cache data of the first sub-application module.
[0153] Understandably, the micro-frontend communication device destroys the cached data of the first sub-application module based on the received cache clearing instruction.
[0154] Therefore, in this embodiment of the disclosure, the fourth message sent by the main application module is received by the third message module, and the fourth message is parsed to obtain an executable command, which is a cache cleanup instruction. In this way, the cached data of the sub-application module can be destroyed according to the cache cleanup instruction, thus avoiding the phenomenon of cache pollution.
[0155] In some possible implementations, after executing S701, the method further includes: when the first sub-application module is mounted, setting the application state of the first sub-application module to an active state; or, when the first sub-application module is unmounted, setting the application state of the first sub-application module to a destroyed state.
[0156] Understandably, when the micro-frontend communication device switches the first sub-application module, it sets the application state of the first sub-application module to the corresponding state. The destruction state is used to indicate that the first sub-application module is temporarily not accessed by the user and / or the main application module.
[0157] This completes the communication method for the micro-frontend.
[0158] Therefore, in this embodiment, the first message module receives a first message sent by the first sub-application module, parses the first message to obtain the executable command corresponding to the first message, and executes the executable command. Thus, communication between the main application module and the sub-application module is achieved by executing the executable command corresponding to the parsed first message. Further, by parsing the first message, a second sub-application module is determined; the second message module of the second sub-application module is called, and the second message module is used for communication between the second sub-application module and the main application module; sending the first message to the second sub-application module through the second message module enables communication between sub-application modules; furthermore, when the executable command is a cached instruction, executing the cached instruction enables caching of the sub-application module.
[0159] Furthermore, in this embodiment, when the main application module and sub-application modules, as well as the sub-application module and main application module, communicate, only the information currently needed for communication is transmitted, without carrying any interference information. Therefore, the communication granularity in the micro-frontend communication method of this embodiment is smaller and more precise. During communication, the transmitted information packets are also smaller, triggering only changes related to the current communication. Thus, the communication performance of the micro-frontend communication method in this embodiment is higher and more convenient. In this embodiment, the communication mechanism is finely divided and integrated into functional modules. By adding a message execution module, communication and business processing are decoupled in a command mode, making message processing more flexible and facilitating later maintenance and expansion. When caching sub-application modules, memory usage is small, and page isolation is unnecessary, thus avoiding cache pollution.
[0160] Based on the same inventive concept, this disclosure provides a micro-frontend communication device. This device can be a chip or system-on-a-chip in a micro-frontend architecture, or a functional module in the micro-frontend architecture used to implement the methods described in the above embodiments. This micro-frontend communication device can implement the functions performed by the micro-frontend architecture in the above embodiments, and these functions can be implemented by hardware executing corresponding software. This hardware or software includes one or more modules corresponding to the above functions. Figure 12 This is a schematic diagram of a micro-front-end communication device in an embodiment of this disclosure. See also... Figure 12 As shown, the micro-frontend communication device 1200 may include: a receiving module 1201, used to receive a first message sent by a first sub-application module, the first message module being used for communication between the main application module and the first sub-application module; and a message execution module 1202, used to parse the first message to obtain the executable command corresponding to the first message; and execute the executable command.
[0161] In some possible implementations, mounting module 1203 is used to mount the first sub-application module; sending module 1104 is used to transmit the first message module to the first sub-application module.
[0162] In some possible implementations, the apparatus further includes: a message execution module 1202, used to parse the first message and determine the second sub-application module; to call the second message module of the second sub-application module, the second message module being used for communication between the second sub-application module and the main application module; and a sending module 1201, used to send the first message to the second sub-application module through the second message module.
[0163] In some possible implementations, the mounting module 1203 is also used to mount the second sub-application module; the receiving module 1201 is also used to receive the second message module transmitted by the second sub-application module; and the message execution module 1202 saves the second message module.
[0164] In some possible implementations, the main application module includes a sub-application module message module repository; the message execution module 1202 is also used to save the second message module to the sub-application module message module repository.
[0165] In some possible implementations, the executable command is a cache query instruction; the message execution module 1202 is used to execute the cache query instruction to query the cached data of the first sub-application module in the cache library of the sub-application module of the main application module; when the cached data is found, the third message module is called and the cached data is sent to the first sub-application module through the third message module. The third message module is used for communication between the first sub-application module and the main application module.
[0166] In some possible implementations, the message execution module 1202 is also used to call the third message module when no cached data is found, and send a third message to the first sub-application module through the third message module. The third message is used to instruct the first sub-application module to perform cache initialization.
[0167] In some possible implementations, the executable command is a cache instruction; the message execution module 1202 is used to execute the cache instruction and store the cached data of the first sub-application module into the sub-application module cache library of the main application module.
[0168] It should be noted that the specific implementation process of the receiving module 1201, message execution module 1202, mounting module 1203, and sending module 1204 can be found in [reference needed]. Figures 2 to 6 For the sake of brevity, the detailed description of the embodiments will not be repeated here.
[0169] The receiving module 1201, message execution module 1202, mounting module 1203, and sending module 1204 mentioned in this embodiment can be one or more processors.
[0170] Based on the same inventive concept, this disclosure provides a micro-frontend communication device. This device can be a chip or system-on-a-chip in a micro-frontend architecture, or a functional module in the micro-frontend architecture used to implement the methods described in the above embodiments. This micro-frontend communication device can implement the functions performed by the micro-frontend architecture in the above embodiments, and these functions can be implemented by hardware executing corresponding software. This hardware or software includes one or more modules corresponding to the above functions. Figure 13 This is another structural schematic diagram of the micro-front-end communication device in the embodiments of this disclosure, see [link to schematic diagram]. Figure 13As shown, the micro-frontend communication device 1300 may include: a message execution module 1301, used to obtain a first message; call a first message module, the first message module being used for communication between the main application module and the first sub-application module; and a sending module 1302, used to send the first message to the main application module.
[0171] In some possible implementations, the message execution module 1301 is also configured to receive the first message module transmitted by the main application module when the first sub-application module is mounted.
[0172] In some possible implementations, the message execution module 1301 is further configured to send a third message module to the main application module when the first sub-application module is mounted. The third message module is used for communication between the first sub-application module and the main application module.
[0173] In some possible implementations, the executable command corresponding to the first message is a cache query instruction, which is used to instruct the main application module to query the cached data of the first sub-application module; the message execution module 1301 is also used to receive the cached data sent by the main application module through the third message module; load the cached data, and perform page rendering based on the cached data.
[0174] In some possible implementations, the message execution module 1301 is further configured to receive a third message sent by the first sub-application module through the third message module; parse the third message to obtain a cache initialization instruction; execute the cache initialization instruction to initialize the cache; and render the page based on the initialized cache data.
[0175] In some possible implementations, the message execution module 1301 is further configured to: determine that the application state of the first sub-application module is active; obtain the cached data of the first sub-application module; and the destruction module 1303 is configured to destroy the cached data.
[0176] In some possible implementations, the message execution module 1301 is further configured to generate a first message based on the cached data, the first message being used to instruct the main application module to cache the cached data.
[0177] In some possible implementations, the message execution module 1301 is further configured to receive a fourth message sent by the main application module through the third message module, the fourth message being used to instruct the closing of the page corresponding to the first sub-application module; parse the fourth message to obtain a cache clearing instruction; and the destruction module 1303 is configured to execute the cache clearing instruction to destroy the cache data of the first sub-application module.
[0178] In some possible implementations, the message execution module 1301 is further configured to set the application state of the first sub-application module to an active state when the first sub-application module is mounted; or to set the application state of the first sub-application module to a destroyed state when the first sub-application module is unmounted.
[0179] It should be noted that the specific implementation process of message execution module 1301, sending module 1302, and destruction module 1303 can be found in [reference needed]. Figures 7 to 11 For the sake of brevity, the detailed description of the embodiments will not be repeated here.
[0180] The message execution module 1301, sending module 1302, and destruction module 1303 mentioned in this embodiment can be one or more processors.
[0181] Based on the same inventive concept, this disclosure provides a terminal device that may be consistent with the micro front-end communication device described in one or more of the above embodiments. Figure 14 This is a schematic diagram of the structure of a terminal device according to an embodiment of this disclosure. See also... Figure 14 As shown, the terminal device 1400 can use general-purpose computer hardware, including a processor 1401 and a memory 1402.
[0182] Optionally, the processor 1401 and the memory 1402 can communicate via bus 1403.
[0183] In some possible implementations, at least one processor 1301 can constitute any physical device having circuitry that performs logical operations on one or more inputs. For example, at least one processor may include one or more integrated circuits (ICs), including application-specific integrated circuits (ASICs), microchips, microcontrollers, microprocessors, all or part of a central processing unit (CPU), graphics processing unit (GPU), digital signal processor (DSP), field-programmable gate array (FPGA), or other circuitry suitable for executing instructions or performing logical operations. Instructions executed by at least one processor may, for example, be preloaded into memory integrated with or embedded in the controller, or may be stored in separate memory. Memory may include random access memory (RAM), read-only memory (ROM), hard disk, optical disk, magnetic media, flash memory, other permanent, fixed, or volatile memory, or any other mechanism capable of storing instructions. In some embodiments, at least one processor may include more than one processor. Each processor may have a similar architecture, or processors may have different configurations that are electrically connected or disconnected from each other. For example, the processor may be a discrete circuit or integrated into a single circuit. When more than one processor is used, the processors may be configured to operate independently or collaboratively. Processors may be coupled electrically, magnetically, optically, acoustically, mechanically, or by other means that allow them to interact. According to one embodiment of this disclosure, a computer-readable storage medium is also provided having computer instructions stored thereon that are executed by a processor using the steps of the calibration method described above. Memory 1402 may include computer storage media in the form of volatile and / or non-volatile memory, such as read-only memory and / or random access memory. Memory 1402 may store operating systems, application programs, other program modules, executable code, program data, user data, etc.
[0184] In one embodiment, the memory 1402 stores information for implementing... Figure 14 The execution instructions for the functions of the message module 1201, message execution module 1202, and mounting module 1203. Figure 12 The functions / implementation processes of the message module 1201, message execution module 1202, and mounting module 1203 can all be accessed through... Figure 14 The processor 1401 in the memory calls the execution instructions stored in the memory 1402 to implement the function. For the specific implementation process and function, please refer to the above-mentioned related embodiments.
[0185] In another embodiment, the memory 1402 described above stores information for implementing... Figure 13 The message execution module 1301 executes the instructions for its functions. Figure 13 The functions / implementation processes of the message execution module 1301, the sending module 1302, and the destruction module 1303 can all be achieved through... Figure 14 The processor 1401 in the memory calls the execution instructions stored in the memory 1402 to implement the function. For the specific implementation process and function, please refer to the above-mentioned related embodiments.
[0186] Based on the same inventive concept, this disclosure provides a terminal device, including: a memory and a processor; the processor is connected to the memory and configured to execute computer-executable instructions stored in the memory, and is capable of implementing the micro-frontend communication method as described in one or more of the above embodiments.
[0187] Based on the same inventive concept, this disclosure provides a computer storage medium storing computer-executable instructions. After being executed by a processor, the computer-executable instructions can realize the micro-frontend communication method as described in one or more of the above embodiments.
[0188] Those skilled in the art will understand that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure. Other embodiments of the invention will readily conceive of by those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any modifications, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art regarding working fluids not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0189] The above description is merely an exemplary embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A micro-frontend communication method, characterized in that, include: The main application module receives a first message sent by the first sub-application module through the first message module. The first message module is used for communication between the main application module and the first sub-application module. Parse the first message to obtain the executable command corresponding to the first message; Execute the executable command; When the executable command is a cache query instruction; Executing the executable command includes: Execute the cache query instruction to query the cached data of the first sub-application module in the cache library of the sub-application module of the main application module; When the cached data is retrieved, the third message module is invoked, and the cached data is sent to the first sub-application module through the third message module. The third message module is used for communication between the first sub-application module and the main application module. When the cached data is not found, the third message module is invoked, and a third message is sent to the first sub-application module through the third message module. The third message is used to instruct the first sub-application module to perform cache initialization. When the executable command is a cached instruction; executing the executable command includes: Execute the caching instruction to store the cached data of the first sub-application module into the sub-application module cache library of the main application module; After receiving the first message sent by the first sub-application module through the first message module, the method further includes: Analyze the first message to determine the second sub-application module; The second message module of the second sub-application module is invoked. The second message module is used for communication between the second sub-application module and the main application module. The first message is sent to the second sub-application module through the second message module; Wherein, the first message module is the message module of the main application module, the second message module is the message module of the second sub-application module, and the third message module is the message module of the first sub-application module. The first message module, the second message module, and the third message module are different.
2. The method according to claim 1, characterized in that, Before receiving the first message sent by the first sub-application module through the first message module, the method further includes: Mount the first sub-application module; The first message module is passed to the first sub-application module.
3. The method according to claim 1, characterized in that, Before receiving the first message sent by the first sub-application module through the first message module, the method further includes: Mount the second sub-application module; The module that receives the second message transmitted by the second sub-application module; Save the second message module.
4. The method according to claim 3, characterized in that, The main application module includes a sub-application module, a message module, and a repository. The module for saving the second message includes: Save the second message module to the message module repository of the sub-application module.
5. A communication method for a micro-frontend, characterized in that, include: Get the first news; The first message module is invoked, which is used for communication between the main application module and the first sub-application module; The first message is sent to the main application module through the first message module, so that after the main application module receives the first message sent by the first sub-application module through the first message module, it parses the first message to determine the second sub-application module; and calls the second message module of the second sub-application module, which is used for the second sub-application module to communicate with the main application module. The first message is sent to the second sub-application module through the second message module; When the executable command corresponding to the first message is a cache query instruction, the cache query instruction is used to instruct the main application module to query the cached data of the first sub-application module; When the main application module retrieves the cached data, the method further includes: The cached data sent by the main application module is received through the third message module; Load the cached data and render the page based on the cached data; When the main application module does not find the cached data, the method further includes: The third message module receives the third message sent by the main application module. Parse the third message to obtain the cache initialization instruction; Execute the cache initialization instruction to initialize the cache; Render the page based on the initialized cached data; Wherein, the first message module is the message module of the main application module, the second message module is the message module of the second sub-application module, and the third message module is the message module of the first sub-application module. The first message module, the second message module, and the third message module are different.
6. The method according to claim 5, characterized in that, Prior to invoking the first message module, the method further includes: When the first sub-application module is mounted, it receives the first message module transmitted by the main application module.
7. The method according to claim 5, characterized in that, Prior to invoking the first message module, the method further includes: When the first sub-application module is mounted, it sends a third message module to the main application module. The third message module is used for communication between the first sub-application module and the main application module.
8. The method according to claim 7, characterized in that, The method further includes: Determine that the application status of the first sub-application module is active. The cached data is destroyed based on the activation status.
9. The method according to claim 8, characterized in that, The acquisition of the first message includes: Based on the cached data, the first message is generated, and the first message is used to instruct the main application module to cache the cached data.
10. The method according to claim 7, characterized in that, The method further includes: The third message module receives a fourth message sent by the main application module, which is used to instruct the closing of the page corresponding to the first sub-application module. Parse the fourth message to obtain the cache clearing instruction; Execute the cache cleanup command to destroy the cache data of the first sub-application module.
11. The method according to claim 5, characterized in that, The method further includes: When the first sub-application module is mounted, set its application status to active; or, When the first sub-application module is uninstalled, its application status is set to destroyed.
12. A communication device with a micro-frontend, characterized in that, include: The first message module is used to receive the first message sent by the first sub-application module. The first message module is used for communication between the main application module and the first sub-application module. The message execution module is used to parse the first message to obtain the executable command corresponding to the first message; and execute the executable command. When the executable command is a cache query instruction; the message execution module is used to execute the cache query instruction, query the cached data of the first sub-application module in the cache library of the sub-application module of the main application module; when the cached data is found, the third message module is invoked, and the cached data is sent to the first sub-application module through the third message module, which is used for communication between the first sub-application module and the main application module; when the cached data is not found, the third message module is invoked, and a third message is sent to the first sub-application module through the third message module, which is used to instruct the first sub-application module to perform cache initialization; When the executable command is a cache instruction; the message execution module is used to execute the cache instruction and store the cached data of the first sub-application module into the sub-application module cache library of the main application module; The message execution module is used to parse the first message and determine the second sub-application module; The second message module of the second sub-application module is invoked. The second message module is used for communication between the second sub-application module and the main application module. The first message is sent to the second sub-application module through the second message module. Wherein, the first message module is the message module of the main application module, the second message module is the message module of the second sub-application module, and the third message module is the message module of the first sub-application module. The first message module, the second message module, and the third message module are different.
13. A communication device with a micro-frontend, characterized in that, include: The message execution module is used to obtain the first message; The first message module is invoked, which is used for communication between the main application module and the first sub-application module; The first message module is used to send the first message to the main application module, so that after the main application module receives the first message sent by the first sub-application module through the first message module, it parses the first message to determine the second sub-application module; and calls the second message module of the second sub-application module, which is used for the second sub-application module to communicate with the main application module. The first message is sent to the second sub-application module through the second message module; When the executable command corresponding to the first message is a cache query instruction, the cache query instruction is used to instruct the main application module to query the cached data of the first sub-application module; the message execution module is also used to receive the cached data sent by the main application module through the third message module when the main application module finds the cached data; load the cached data and perform page rendering based on the cached data; when the main application module does not find the cached data, receive a third message sent by the main application module through the third message module; parse the third message to obtain a cache initialization instruction; execute the cache initialization instruction to perform cache initialization; and perform page rendering based on the initialized cached data; Wherein, the first message module is the message module of the main application module, the second message module is the message module of the second sub-application module, and the third message module is the message module of the first sub-application module. The first message module, the second message module, and the third message module are different.
14. A terminal device, characterized in that, include: Memory, which stores computer-executable instructions; A processor, connected to the memory, is configured to implement the method as described in any one of claims 1 to 11 by executing the computer-executable instructions.
15. A computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a processor, can implement the method as described in any one of claims 1 to 11.