Information processing method, device, and storage medium
By pre-acquiring and caching the static resources of the sub-application during the idle period of the information processing device, the problem of slow loading when the server is busy is solved, and the effect of faster loading of static elements into the base application is achieved.
Patent Information
- Application Number
- CN202110676365.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-18
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-06-18
AI Technical Summary
When the server is busy, the static resources of the sub-application are loaded more slowly into the base application, affecting the loading speed.
The information processing device obtains the static resources of the sub-application from the server in advance during the idle time period and caches them in the application cache. When receiving the rendering instruction, it directly loads the static elements from the cache to the base application, avoiding requesting from the server again.
Improved loading speed of static elements into the base app, reducing delays when the server is busy and improving loading efficiency.
Smart Images

Figure CN113391855B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to an information processing method and device, and a storage medium. Background Art
[0002] Micro front-ends are divided into base applications and sub-applications. The base application is the main application, and the small applications that are integrated into the base application are called sub-applications.
[0003] In the existing technology, the sub-application includes static resources. When rendering the sub-application to the base application, it is necessary to first request the server, obtain the static resources corresponding to the sub-application on the server, and then load the static resources into the base application. In this way, if the server is busy, the speed of obtaining the static resources of the sub-application will be slowed down, thereby reducing the speed of loading the static resources into the base application. Summary of the Invention
[0004] In order to solve the above technical problems, the embodiments of the present application hope to provide an information processing method and device, and a storage medium, which can improve the speed of loading static elements into a base application.
[0005] The technical solution of this application is achieved as follows:
[0006] The present invention provides an information processing method, which is applied to an information processing device. The information processing method includes:
[0007] Calling a static resource acquisition method to receive at least one sub-application information transmitted by a client; and obtaining at least one resource location address corresponding to at least one sub-application from the at least one sub-application information;
[0008] Calling the static resource acquisition method to request at least one group of static elements corresponding to the at least one sub-application from the server according to the at least one resource location address during an idle time period;
[0009] Upon receiving a target rendering instruction of a target sub-application in the at least one sub-application, a target group static element corresponding to the target sub-application is obtained from the at least one group of static elements, and the target group static element is loaded into the base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application.
[0010] An embodiment of the present application provides an information processing device, the device comprising:
[0011] a receiving unit configured to call a static resource acquisition method to receive at least one sub-application information transmitted by a client; and upon receiving a target rendering instruction of a target sub-application in the at least one sub-application, obtain a target group of static elements corresponding to the target sub-application from the at least one group of static elements;
[0012] An acquiring unit, configured to acquire at least one resource location address corresponding to at least one sub-application from the at least one sub-application information;
[0013] A requesting unit, configured to call the static resource acquisition method and request at least one group of static elements corresponding to the at least one sub-application from the server according to the at least one resource location address during an idle time period;
[0014] An adding unit is used to load the target group static elements into a base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application.
[0015] An embodiment of the present application provides an information processing device, the device comprising:
[0016] A memory, a processor and a communication bus, wherein the memory communicates with the processor via the communication bus, and the memory stores an information processing program executable by the processor. When the information processing program is executed, the information processing method described above is executed by the processor.
[0017] An embodiment of the present application provides a storage medium having a computer program stored thereon, which is applied to an information processing device, and is characterized in that when the computer program is executed by a processor, the above-mentioned information processing method is implemented.
[0018] An embodiment of the present application provides an information processing method, device, and storage medium. The information processing method is applied to an information processing device. The information processing method includes: calling a static resource acquisition method to receive at least one sub-application information transmitted by a client; and obtaining at least one resource location address corresponding to at least one sub-application from the at least one sub-application information; calling the static resource acquisition method to request at least one group of static elements corresponding to at least one sub-application from a server according to the at least one resource location address during an idle time period; upon receiving a target rendering instruction of a target sub-application in at least one sub-application, obtaining a target group of static elements corresponding to the target sub-application from the at least one group of static elements, and loading the target group of static elements into a base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application. The above-mentioned method is adopted to implement the scheme. The information processing device sets a static resource acquisition method. The information processing device can call the static resource acquisition method to receive at least one sub-application information, and call the static resource acquisition method when the information processing device is idle. According to at least one resource location address corresponding to at least one sub-application information, at least one group of static elements corresponding to at least one sub-application is obtained from the server. When the information processing device receives the target rendering instruction of the target sub-application in at least one sub-application, the information processing device no longer needs to request the target group of static elements from the server. The static resource acquisition method can be directly used to obtain the target group of static elements from at least one group of static elements obtained when the information processing device is idle, so as to load the target static elements directly into the base application to obtain the micro-frontend, thereby improving the speed of the information processing device to obtain the target group of static elements, thereby improving the speed of loading the target static elements into the base application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A flow chart of an information processing method provided in an embodiment of the present application;
[0020] Figure 2 An exemplary information processing method provided in this application embodiment Figure 1 ;
[0021] Figure 3 An exemplary information processing method provided in this application embodiment Figure 2 ;
[0022] Figure 4 A schematic diagram of the structure of an information processing device provided in an embodiment of the present application Figure 1 ;
[0023] Figure 5 A schematic diagram of the structure of an information processing device provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION
[0024] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
[0025] Example 1
[0026] The present invention provides an information processing method, which is applied to an information processing device. Figure 1 A flow chart of an information processing method provided in an embodiment of the present application is as follows: Figure 1 As shown, the information processing method may include:
[0027] S101. Call a static resource acquisition method to receive at least one sub-application information transmitted by a client; and obtain at least one resource location address corresponding to at least one sub-application from the at least one sub-application information.
[0028] An information processing method provided in an embodiment of the present application is applicable to a scenario in which an information processing device renders a sub-application.
[0029] In the embodiments of the present application, the information processing device may be implemented in various forms. For example, the information processing device described in the present application may include devices such as mobile phones, cameras, tablet computers, laptop computers, PDAs, portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, and devices such as digital TVs, desktop computers, and servers.
[0030] In an embodiment of the present application, the static resource acquisition method can be the prefetchApps method, or it can be other methods of obtaining static resources of at least one sub-application from the server. The specific method can be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0031] In an embodiment of the present application, a prefetchApps tool is provided in the information processing device, and the prefetchApps tool carries a prefetchApps method.
[0032] In an embodiment of the present application, the information processing device may first encapsulate a method named prefetchApps, and use the prefetchApps method to receive an array as a parameter, wherein the array contains at least one sub-application information of at least one sub-application. The prefetchApps method will obtain at least one set of static elements based on the at least one sub-application information passed in during the idle time period of the information processing device (browser), and cache the at least one set of static elements in the appCaches object. When the sub-application is rendered, if the static elements of the sub-application already exist in the appCaches object, the static elements are directly obtained from the appCaches object for rendering.
[0033] In an embodiment of the present application, the process of an information processing device obtaining at least one group of static elements from at least one sub-application information can be that the information processing device calls the prefetchApps method to first obtain at least one hypertext address corresponding to at least one sub-application from the server according to the at least one sub-application information, and then the information processing device parses the at least one hypertext address to obtain at least one group of static elements.
[0034] It should be noted that the at least one group of static elements includes at least one group of Cascading Style Sheets (CSS) static resources and at least one group of JS (Javascript) static resources.
[0035] It should be noted that the at least one sub-application information includes at least one resource location address corresponding to the at least one sub-application, wherein the at least one resource location address may be a Uniform Resource Locator (URL) address of the at least one sub-application.
[0036] Specifically, the information processing device may call the prefetchApps method to first obtain at least one hypertext address corresponding to at least one sub-application from the server according to the URL address of at least one sub-application.
[0037] In the embodiment of the present application, at least one sub-application corresponds to at least one sub-application information; at least one sub-application corresponds to at least one resource location address. Specifically, one sub-application corresponds to one sub-application information; one sub-application corresponds to one resource location address.
[0038] In an embodiment of the present application, the process of the information processing device obtaining at least one resource location address corresponding to at least one sub-application from at least one sub-application information also includes: the information processing device obtaining at least one sub-application identifier corresponding to at least one sub-application from at least one sub-application information.
[0039] It should be noted that, in addition to the at least one resource location address corresponding to the at least one sub-application, the at least one sub-application information also includes at least one sub-application identifier corresponding to the at least one sub-application, wherein the at least one sub-application identifier may be the name of the at least one sub-application.
[0040] In an embodiment of the present application, after the information processing device obtains at least one sub-application identifier, the information processing device caches the at least one sub-application identifier in the appCaches object.
[0041] S102: Call a static resource acquisition method to request at least one group of static elements corresponding to at least one sub-application from a server according to at least one resource location address during an idle time period.
[0042] In an embodiment of the present application, after the information processing device obtains at least one resource location address corresponding to at least one sub-application from at least one sub-application information, the information processing device can request at least one group of static elements corresponding to at least one sub-application from the server based on the at least one resource location address; and cache the at least one group of static elements to the application cache.
[0043] In an embodiment of the present application, at least one sub-application corresponds one-to-one to at least one group of static elements. Specifically, one sub-application corresponds to a group of static elements.
[0044] In an embodiment of the present application, the idle time period can be the time when the central processing unit (CPU) in the information processing device waits for the completion of the input / output (I / O) request. The idle time can also be a preset time period configured in the information processing device. The specific time period can be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0045] In an embodiment of the present application, the process of an information processing device calling a static resource acquisition method to request at least one group of static elements corresponding to at least one sub-application from a server according to at least one resource location address during an idle time period includes: the information processing device uses the static resource acquisition method to send at least one static resource acquisition request corresponding to at least one resource location address to the server during an idle time period; when the static resource acquisition method receives response information sent by the server based on at least one static resource acquisition request, the information processing device obtains at least one hypertext address corresponding to at least one sub-application from the response information; the information processing device parses at least one hypertext address to obtain at least one group of static elements.
[0046] In the embodiment of the present application, the hypertext address may be a Hypertext Markup Language (HTML) address. For example, the HTML address may be http: / / www.jjd.com / index.html.
[0047] In an embodiment of the present application, the process of an information processing device parsing at least one hypertext address to obtain at least one group of static elements includes: the information processing device obtains at least one hypertext information from at least one hypertext address and converts the at least one hypertext information into at least one group of elements; the information processing device filters out a first group of static elements from a first group of elements in at least one group of elements, until at least one group of static elements is filtered out from at least one group of elements.
[0048] It should be noted that the at least one hypertext information may be at least one HTML content.
[0049] In an embodiment of the present application, the process of an information processing device acquiring at least one hypertext message from at least one hypertext address includes the information processing device calling a loadMicroApp function and passing in the at least one hypertext address. After receiving the at least one hypertext address, loadMicroApp converts the at least one hypertext address into at least one hypertext address in a string format, and then calls the information processing device's own fetch method to acquire the at least one hypertext message from the at least one hypertext address in the string format passed in. It should be noted that the at least one hypertext message is a string type message.
[0050] In the embodiment of the present application, at least one hypertext address corresponds to at least one hypertext message on a one-to-one basis. Specifically, one hypertext address corresponds to one hypertext message.
[0051] In an embodiment of the present application, the process of an information processing device converting at least one hypertext information into at least one group of elements may be that the information processing device first converts the first hypertext information in the at least one hypertext information into a first group of elements, and then the information processing device converts the second hypertext information in the at least one hypertext information into a second group of elements, ... until the information processing device converts the last hypertext information in the at least one hypertext information into the last group of elements.
[0052] In an embodiment of the present application, the process of an information processing device converting the first hypertext information in at least one hypertext information into a first group of elements includes: the information processing device calls the document.createElement method to create a partition mark tag as a div (division) tag, and then the information processing device inserts the obtained at least one hypertext information into the div tag through the innerHTML method, thereby converting the at least one hypertext information into a document object model (Document Object Modal, DOM) structure to obtain at least one group of elements.
[0053] In an embodiment of the present application, the process of an information processing device screening out a first group of static elements from a first group of elements in at least one group of elements includes: the information processing device screening out target elements from the first group of elements based on preset static resource attributes; the information processing device obtaining static resource information corresponding to the target elements; the information processing device using the static resource information to adjust the target tag of the target element to obtain the first group of static elements.
[0054] In an embodiment of the present application, the preset static resource attributes may be CSS static resource attributes or JS static resource attributes.
[0055] In an embodiment of the present application, the information processing device may first detect the attributes of the first element of the first group of elements, and if the attributes of the first element are preset static resource attributes, the first element is determined to be the target element; then the information processing device detects the attributes of the second element in the first group of elements, and if the attributes of the second element are static resource attributes, the second element is determined to be the target element; ...; until all target elements are filtered out from the first group of elements.
[0056] It should be noted that the first element is any element in the first group of elements; the second element is any element in the multiple elements except the first element.
[0057] In the embodiment of the present application, the static resource information is the content of the static resource. Specifically, if the static resource attribute can be a CSS static resource attribute, the static resource information is the content of the CSS static resource; if the static resource attribute can be a JS static resource attribute, the static resource information is the content of the JS static resource. The content of the CSS static resource and the content of the JS static resource are both string type content.
[0058] In an embodiment of the present application, the process of an information processing device screening a target element from a first group of elements according to preset static resource attributes includes: the information processing device obtains a first group of element tags and a first group of address attributes corresponding to the first group of elements; when the first tag in the first group of element tags is a connection tag or a script tag, and there is a first address attribute corresponding to the first tag, the information processing device determines that the element corresponding to the first tag is the target element.
[0059] It should be noted that the first tag is a partial tag in the first group of element tags, and the first address attribute is a partial address attribute in the first group of address attributes.
[0060] In the embodiment of the present application, the first group of elements corresponds one-to-one to the first group of element labels, and the first group of elements corresponds one-to-one to the first group of address attributes.
[0061] In the embodiment of the present application, the first group of element tags includes a connection tag and a script tag, wherein the connection tag can be a link tag and the script tag can be a script tag.
[0062] In an embodiment of the present application, the first set of address attributes includes a hypertext reference (href) attribute and a sparse representation-based classifier (src) attribute. Specifically, if the first element in the first set of elements is a link tag, the first address attribute corresponding to the first element is the href attribute; if the first element is a script tag, the first address attribute is the src attribute.
[0063] In an embodiment of the present application, after the information processing device obtains the first group of element tags and the first group of address attributes corresponding to the first group of elements, the information processing device can first detect the first element tag of the first element. When the information processing device determines that the first element tag is a connection tag, the information processing device detects the first address attribute and the element attribute of the first element. When the information processing device determines that the first address attribute exists and the element attribute is a string attribute, the information processing device determines that the first element is a target element that meets the (CSS) static resource attribute. The information processing device obtains the static resource information corresponding to the target element; uses the static resource information to adjust the target tag of the target element to obtain a static element. The information processing device then detects the element tag of the next element (i.e., the second element) in the first group of elements and processes the second element until all the first group of static elements that meet the preset static resource attributes are screened out in the first group of elements. When the information processing device determines that the tag of the first element is a connection tag, but the information processing device determines that the first address attribute does not exist, or the element attribute of the first element is not a string attribute, the information processing device discards the first element and processes the next element in the first group of elements (i.e., the second element) until all the first group of static elements that meet the preset static resource attributes are screened out in the first group of elements. If the information processing device determines that the element tag of the first element is not a connection tag but a script tag, the information processing device determines that the tag of the first element is specifically an inline script tag when it determines that the address attribute of the first element does not exist. The information processing device discards the first element and processes the next element until all the first group of static elements that meet the preset static resource attributes are screened out among multiple elements. If the information processing device determines that the first element tag of the first element is a script tag and the first address attribute exists, the information processing device determines that the first element tag is a remote script tag, and the information processing device determines that the first element is a target element that meets the (JS) static resource attribute. The information processing device obtains the static resource information corresponding to the target element; uses the static resource information to adjust the target tag of the target element to obtain a static element. The information processing device then detects the second element tag of the next element (i.e., the second element) in the first group of elements and processes the next element until all the first group of static elements that meet the preset static resource attributes are screened out from the first group of elements.When the information processing device determines that the first element tag of the first element is neither a script tag nor a connection tag, the information processing device determines that the first element is a common element. The information processing device can further determine whether the common element has child elements. If the common element has child elements, the information processing device can then detect the tag of the child element and filter out static elements that meet the preset static resource attributes from the child elements. If the common element has no child elements, the information processing device discards the common element and then processes the next element until all the first group of static elements that meet the preset static resource attributes are filtered out in the first group of elements.
[0064] In an embodiment of the present application, when the first tag in the first group of element tags is a connection tag or a script tag, and there is a first address attribute corresponding to the first tag, the process of the information processing device determining that the element corresponding to the first tag is the target element includes: when the first tag in the first group of element tags is a script tag, and the first address attribute corresponding to the first tag exists, the information processing device determines that the element corresponding to the first tag is the target element; when the first tag in the first group of element tags is a connection tag, the information processing device detects the first address attribute and the element attribute of the element corresponding to the first tag; when the element attribute is a string attribute and the first address attribute exists, the information processing device determines that the element corresponding to the first tag is the target element.
[0065] It should be noted that if the first tag in the first group of element tags is a script tag (i.e., a script tag) and the first address attribute (i.e., a src attribute) exists, the information processing device determines that the element corresponding to the first tag is the target element. If the first tag in the first group of element tags is a link tag (i.e., a link tag), the information processing device further determines that the element attribute corresponding to the first tag is a string attribute and the first address attribute (i.e., a href attribute) exists, the information processing device determines that the element corresponding to the first tag is the target element.
[0066] It should be noted that the element attribute may be a rel (relationship) attribute, and the string attribute may be a string "stylesheet".
[0067] In an embodiment of the present application, if the first tag is neither a connection tag nor a script tag, the information processing device can determine that the element corresponding to the first tag is a common element, and the information processing device can further determine whether the common element has child elements. If the common element has child elements, the information processing device can process the child elements in sequence and filter out static elements that meet the static resource attributes from the child elements. If the common element does not have child elements, the information processing device discards the common element and then processes the next element, until the information processing device filters out all static elements that meet the static resource attributes from the first group of elements.
[0068] In an embodiment of the present application, before the information processing device obtains the static resource information corresponding to the target element, the information processing device will also obtain the first address attribute corresponding to the target element; the information processing device obtains the element address of the target element based on the first address attribute; accordingly, the process of the information processing device obtaining the static resource information corresponding to the target element includes: the information processing device obtains the static resource information pointed to by the element address.
[0069] In the embodiment of the present application, if the first address attribute exists, the value of the first address attribute is the element address. After the information processing device obtains the first address attribute, the information processing device can obtain the value of the first address attribute to obtain the element address.
[0070] In an embodiment of the present application, the information processing device can obtain the static resource information pointed to by the element address through the fetch method.
[0071] In an embodiment of the present application, if the target tag of the target element is a connection tag, the information processing device can obtain the content of the CSS static resource pointed to by the element address through the fetch method; if the target tag of the target element is a script tag, the information processing device can obtain the content of the JS static resource pointed to by the element address through the fetch method.
[0072] In an embodiment of the present application, before the information processing device obtains at least one hypertext information from at least one hypertext address, the information processing device will also obtain at least one domain name of at least one sub-application from at least one hypertext address; accordingly, the process of the information processing device obtaining the element address of the target element based on the first address attribute includes: the information processing device obtains the initial address of the target element based on the first address attribute; when the initial address does not include the domain name, the information processing device determines the target domain name corresponding to the target element from at least one domain name; the information processing device adds the target domain name to the initial address to obtain the element address; when the initial address includes the domain name, the information processing device uses the initial address as the element address.
[0073] In an embodiment of the present application, at least one hypertext address includes at least one domain name of at least one sub-application. After the information processing device obtains at least one hypertext address, the information processing device can obtain at least one domain name from the at least one hypertext address.
[0074] In an embodiment of the present application, when the information processing device determines that the initial address does not include a domain name, it obtains an element address by adding a target domain name to the initial address, so that the visitor can find the content corresponding to the element address in the element address including the target domain name.
[0075] In an embodiment of the present application, the information processing device uses static resource information to adjust the target tag of the target element. Before obtaining the first group of static elements, the information processing device will also create a current tag; accordingly, the information processing device uses static resource information to adjust the target tag of the target element to obtain the first group of static elements, including: the information processing device inserts the static resource information into the current tag to obtain an updated current tag; and replaces the target tag with the updated current tag to obtain the first group of static elements.
[0076] In the embodiment of the present application, the current tag includes a style tag and a current script tag. Specifically, the style tag can be a style tag, and the current script tag can be an inline script tag.
[0077] In the embodiment of the present application, the current tag may be a style tag, or the current tag may be a current script tag. The specific one may be determined according to the actual situation, and the embodiment of the present application does not limit this.
[0078] In an embodiment of the present application, if the target tag of the target element is a connection tag, the information processing device can call the element replacement method of the parent element of the target element to replace the target tag (connection tag) of the target element with the updated current tag, thereby obtaining a first set of static elements. If the target tag of the target element is a script tag, the information processing device can call the element replacement method of the parent element of the target element to replace the target tag (script tag) of the target element with the updated current tag, thereby obtaining a first set of static elements.
[0079] It should be noted that the element replacement method can be the replaceChild method or other methods. The specific method can be determined according to actual conditions and is not limited in the embodiments of the present application.
[0080] In an embodiment of the present application, the current tag includes a style tag; the static resource information includes cascading style static resource information; the information processing device inserts the static resource information into the current tag to obtain an updated current tag, including: the information processing device inserts the cascading style static resource information into the style tag to obtain an updated current tag.
[0081] In an embodiment of the present application, the cascading style static resource information may be the content of a CSS static resource.
[0082] In an embodiment of the present application, if the style tag is a style tag, the information processing device can insert the cascading style static resource information into the style tag by assigning the cascading style static resource information to the textContent variable of the style tag to obtain an updated current tag; the information processing device can also use other methods to insert the cascading style static resource information into the style tag to obtain an updated current tag. The specific method can be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0083] In an embodiment of the present application, the current tag includes the current script tag; the static resource information includes script static resource information; the information processing device inserts the static resource information into the current tag to obtain an updated current tag, including: the information processing device inserts the script static resource information into the current script tag to obtain an updated current tag.
[0084] In an embodiment of the present application, the script static resource information may be the content of a JS static resource.
[0085] In an embodiment of the present application, if the script tag can be a script tag, the information processing device can insert the script static resource information into the script tag by assigning the script static resource information to the textContent variable of the script tag to obtain an updated current tag; the information processing device can also use other methods to insert the script static resource information into the script tag to obtain an updated current tag. The specific method can be determined according to actual conditions, and the embodiment of the present application does not limit this.
[0086] S103. Upon receiving a target rendering instruction of a target sub-application in at least one sub-application, obtain a target group static element corresponding to the target sub-application from at least one group of static elements, and load the target group static element into a base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application.
[0087] In an embodiment of the present application, the information processing device requests at least one group of static elements corresponding to at least one sub-application from the server based on at least one resource location address; and after caching at least one group of static elements into the application cache, the information processing device can obtain the target group of static elements corresponding to the target sub-application from the application cache when receiving the rendering instruction of the target sub-application in at least one sub-application, and load the target group of static elements into the base application to obtain the micro-frontend corresponding to the rendering instruction.
[0088] In this embodiment of the present application, after obtaining the target group static element corresponding to the target sub-application from at least one group of static elements in the information processing device, a formatted DOM structure, namely a div element with a DOM structure, can be obtained based on the target group static element. At this point, the remote CSS static resources and JS static resources have been obtained and placed into the DOM structure as the target group static elements. Finally, the div element with the DOM structure is inserted into the base application. The CSS static resources and JS static resources are automatically effective and executed, and the target sub-application can be rendered normally, thereby completing the construction of the micro frontend of the target sub-application.
[0089] In an embodiment of the present application, the target rendering instruction includes a target sub-application identifier of a target sub-application, and the process of the information processing device obtaining a target group static element corresponding to the target sub-application from at least one group of static elements also includes: the information processing device searches for a first identifier that matches the target sub-application identifier in at least one sub-application identifier; the information processing device obtains a target group static element that matches the first identifier in at least one group of static elements.
[0090] In an embodiment of the present application, at least one sub-application identifier is cached in an appCaches object. The information processing device can match the target sub-application identifier with at least one sub-application identifier one by one in the appCaches object to determine the first identifier. The information processing device then searches for the target group static element that matches the first identifier in at least one group of static elements in the appCaches object.
[0091] In an embodiment of the present application, the information processing device calls a static resource acquisition method and requests at least one group of static elements corresponding to at least one sub-application from a server according to at least one resource location address during an idle time period. When the sub-application to be processed is not an application in at least one sub-application and a rendering instruction of the sub-application to be processed is received, the information processing device obtains the resource location address to be processed corresponding to the sub-application to be processed from the rendering instruction; the information processing device requests the static elements to be processed corresponding to the sub-application to be processed from the server according to the resource location address to be processed.
[0092] In an embodiment of the present application, when the information processing device receives a rendering instruction for a sub-application to be processed and the information processing device determines that the sub-application to be processed does not belong to an application in at least one sub-application, the information processing device obtains the resource location address to be processed corresponding to the sub-application to be processed from the rendering instruction; then the information processing device sends a static resource acquisition request to be processed corresponding to the resource location address to be processed to the server, so that when the information processing device receives a response message to be processed sent by the server based on the static resource acquisition request to be processed, the device obtains the hypertext address to be processed corresponding to the sub-application to be processed from the response message to be processed, and then the information processing device obtains the static element to be processed corresponding to the sub-application to be processed by parsing the hypertext address to be processed.
[0093] For example, an exemplary information processing method is as follows Figure 2 As shown:
[0094] S1. The information processing device calls a static resource acquisition method to receive at least one sub-application information transmitted by a client; and obtains at least one resource location address corresponding to at least one sub-application and at least one sub-application identifier corresponding to at least one sub-application from the at least one sub-application information.
[0095] S2. The information processing device uses a static resource acquisition method to send at least one static resource acquisition request corresponding to at least one resource location address to the server during an idle time period.
[0096] S3. When the static resource acquisition method receives response information sent by the server based on at least one static resource acquisition request, the information processing device obtains at least one hypertext address corresponding to at least one sub-application from the response information.
[0097] S4. The information processing device obtains at least one hypertext information from at least one hypertext address, and converts the at least one hypertext information into at least one group of elements.
[0098] S5. The information processing device obtains a first group of element tags and a first group of address attributes corresponding to the first group of elements.
[0099] It should be noted that the first group of elements is any group of elements in at least one group of elements.
[0100] S6. When the first tag in the first group of element tags is a script tag and the first address attribute corresponding to the first tag exists, the information processing device determines that the element corresponding to the first tag is the target element.
[0101] S7. When the first tag in the first group of element tags is a connection tag, the information processing apparatus detects the first address attribute and the element attribute of the element corresponding to the first tag.
[0102] S8. When the element attribute is a string attribute and the first address attribute exists, the information processing device determines that the element corresponding to the first tag is the target element.
[0103] It should be noted that the first tag is a partial tag in the first group of element tags, and the first address attribute is a partial address attribute in the first group of address attributes.
[0104] S9. The information processing device obtains a first address attribute corresponding to the target element; and obtains the element address of the target element according to the first address attribute.
[0105] S10. The information processing device obtains the static resource information pointed to by the element address.
[0106] S11. The information processing device creates a current tag and inserts static resource information into the current tag to obtain an updated current tag.
[0107] S12. The information processing device replaces the target label of the target element with the updated current label to obtain a first group of static elements, until the information processing device selects at least one group of static elements from at least one group of elements.
[0108] S13. Upon receiving a target rendering instruction from a target sub-application in at least one sub-application, the information processing apparatus searches for a first identifier that matches the target sub-application identifier in at least one sub-application identifier.
[0109] S14. The information processing device obtains a target group static element that matches the first identifier from at least one group of static elements; and loads the target group static element into a base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application.
[0110] For example, an exemplary information processing method is as follows Figure 3 As shown:
[0111] S31 . Upon receiving a target rendering instruction of a target sub-application in at least one sub-application, the information processing apparatus obtains a target sub-application identifier of the target sub-application from the target rendering instruction.
[0112] S32. The information processing apparatus searches for a first identifier matching the target sub-application identifier in at least one sub-application identifier.
[0113] S33. The information processing device obtains a target group of static elements that matches the first identifier from at least one group of static elements.
[0114] S34. The information processing device loads the target group static elements into the base application corresponding to the target sub-application to obtain the micro front-end corresponding to the target sub-application.
[0115] S35. When the information processing apparatus receives a rendering instruction for a sub-application to be processed and the sub-application to be processed is not an application in at least one sub-application, the information processing apparatus obtains a location address of a resource to be processed corresponding to the sub-application to be processed from the rendering instruction.
[0116] S36. The information processing device requests the server for the static element to be processed corresponding to the sub-application to be processed according to the location address of the resource to be processed.
[0117] S37. The information processing device loads the static element to be processed into the base application corresponding to the sub-application to be processed, and obtains the micro front-end corresponding to the sub-application to be processed.
[0118] It can be understood that by setting a static resource acquisition method, the information processing device can call the static resource acquisition method to receive at least one sub-application information, and call the static resource acquisition method when the information processing device is idle, according to at least one resource location address corresponding to at least one sub-application information, to obtain at least one group of static elements corresponding to at least one sub-application from the server, so that when the information processing device receives the target rendering instruction of the target sub-application in at least one sub-application, the information processing device no longer needs to request the target group of static elements from the server, and can directly use the static resource acquisition method to obtain the target group of static elements from at least one group of static elements obtained when the information processing device is idle, so as to load the target static elements directly into the base application to obtain the micro-frontend, thereby improving the speed of the information processing device to obtain the target group of static elements, thereby improving the speed of loading the target static elements into the base application.
[0119] Example 2
[0120] Based on the same inventive concept of the first embodiment, the embodiment of the present application provides an information processing device 1 corresponding to an information processing method; Figure 4 A schematic diagram of the structure of an information processing device provided in an embodiment of the present application Figure 1 , the information processing device 1 may include:
[0121] The receiving unit 11 is configured to call a static resource acquisition method to receive at least one sub-application information transmitted by a client; upon receiving a target rendering instruction of a target sub-application in the at least one sub-application, obtain a target group of static elements corresponding to the target sub-application from the at least one group of static elements;
[0122] An acquiring unit 12, configured to acquire at least one resource location address corresponding to at least one sub-application from the at least one sub-application information;
[0123] The requesting unit 13 is configured to call the static resource acquisition method to request at least one set of static elements corresponding to the at least one sub-application from the server according to the at least one resource location address during an idle time period;
[0124] The adding unit 14 is used to load the target group static elements into the base application corresponding to the target sub-application to obtain the micro front-end corresponding to the target sub-application.
[0125] In some embodiments of the present application, the apparatus further includes a sending unit and a parsing unit;
[0126] The sending unit is configured to send at least one static resource acquisition request corresponding to the at least one resource location address to the server during the idle time period using the static resource acquisition method;
[0127] The acquiring unit 12 is configured to acquire, when the static resource acquisition method receives response information sent by the server based on the at least one static resource acquisition request, at least one hypertext address corresponding to the at least one sub-application from the response information;
[0128] The parsing unit is configured to parse the at least one hypertext address to obtain the at least one group of static elements.
[0129] In some embodiments of the present application, the acquiring unit 12 is configured to acquire at least one sub-application identifier corresponding to the at least one sub-application from the at least one sub-application information.
[0130] In some embodiments of the present application, the target rendering instruction includes a target sub-application identifier of the target sub-application; the device further includes a search unit;
[0131] The searching unit is configured to search the at least one sub-application identifier for a first identifier that matches the target sub-application identifier;
[0132] The acquiring unit 12 is configured to acquire, from the at least one group of static elements, the target group of static elements that matches the first identifier.
[0133] In some embodiments of the present application, the obtaining unit 12 is configured to, when the sub-application to be processed is not an application in the at least one sub-application and a rendering instruction of the sub-application to be processed is received, obtain a resource location address to be processed corresponding to the sub-application to be processed from the rendering instruction;
[0134] The requesting unit 13 is configured to request the server for the static element to be processed corresponding to the sub-application to be processed according to the location address of the resource to be processed.
[0135] In some embodiments of the present application, the device further comprises a conversion unit and a screening unit;
[0136] The acquiring unit 12 is configured to acquire at least one hypertext information from the at least one hypertext address;
[0137] The conversion unit is configured to convert the at least one hypertext information into at least one group of elements;
[0138] The screening unit is configured to screen out a first group of static elements from a first group of elements in the at least one group of elements, until the at least one group of static elements is screened out from the at least one group of elements.
[0139] In some embodiments of the present application, the apparatus further comprises an adjustment unit;
[0140] The screening unit is configured to screen target elements from the first group of elements according to preset static resource attributes;
[0141] The acquisition unit 12 is used to acquire static resource information corresponding to the target element;
[0142] The adjusting unit is configured to adjust the target tag of the target element using the static resource information to obtain the first group of static elements.
[0143] In some embodiments of the present application, the apparatus further includes a determining unit;
[0144] The acquiring unit 12 is configured to acquire a first group of element tags and a first group of address attributes corresponding to the first group of elements;
[0145] The determination unit is used to determine that the element corresponding to the first tag is the target element when the first tag in the first group of element tags is a connection tag or a script tag and there is a first address attribute corresponding to the first tag, the first tag is a partial tag in the first group of element tags, and the first address attribute is a partial address attribute in the first group of address attributes.
[0146] In some embodiments of the present application, the device further comprises a detection unit;
[0147] The determining unit is configured to, if the first tag in the first group of element tags is a script tag and the first address attribute corresponding to the first tag exists, determine that the element corresponding to the first tag is the target element; and if the element attribute is a string attribute and the first address attribute exists, determine that the element corresponding to the first tag is the target element;
[0148] The detection unit is configured to detect the first address attribute and the element attribute of the element corresponding to the first tag when the first tag in the first group of element tags is a connection tag.
[0149] In some embodiments of the present application, the acquiring unit 12 is configured to acquire a first address attribute corresponding to the target element; and acquire an element address of the target element according to the first address attribute;
[0150] Correspondingly, the acquiring unit 12 is configured to acquire the static resource information pointed to by the element address.
[0151] In some embodiments of the present application, the apparatus further comprises a creating unit;
[0152] The creation unit is used to create the current tag;
[0153] Accordingly, the device further comprises an insertion unit and a replacement unit;
[0154] The inserting unit is configured to insert the static resource information into the current tag to obtain an updated current tag;
[0155] The replacement unit is configured to replace the target tag with the updated current tag to obtain the first group of static elements.
[0156] It should be noted that, in actual applications, the above-mentioned receiving unit 11, acquiring unit 12, requesting unit 13 and adding unit 14 can be implemented by a processor 15 on the information processing device 1, specifically a CPU (Central Processing Unit), an MPU (Microprocessor Unit), a DSP (Digital Signal Processing) or a field programmable gate array (FPGA); the above-mentioned data storage can be implemented by a memory 16 on the information processing device 1.
[0157] The present application also provides an information processing device 1, such as Figure 5 As shown, the information processing device 1 includes: a processor 15, a memory 16 and a communication bus 17. The memory 16 communicates with the processor 15 through the communication bus 17. The memory 16 stores a program executable by the processor 15. When the program is executed, the information processing method described above is executed by the processor 15.
[0158] In practical applications, the memory 16 may be a volatile memory, such as a random-access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 15.
[0159] An embodiment of the present application provides a computer-readable storage medium having a computer program thereon, which implements the information processing method described above when the program is executed by the processor 15 .
[0160] It can be understood that by setting a static resource acquisition method, the information processing device can call the static resource acquisition method to receive at least one sub-application information, and call the static resource acquisition method when the information processing device is idle, according to at least one resource location address corresponding to at least one sub-application information, to obtain at least one group of static elements corresponding to at least one sub-application from the server, so that when the information processing device receives the target rendering instruction of the target sub-application in at least one sub-application, the information processing device no longer needs to request the target group of static elements from the server, and can directly use the static resource acquisition method to obtain the target group of static elements from at least one group of static elements obtained when the information processing device is idle, so as to load the target static elements directly into the base application to obtain the micro-frontend, thereby improving the speed of the information processing device to obtain the target group of static elements, thereby improving the speed of loading the target static elements into the base application.
[0161] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.
[0162] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can 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 generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0163] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0164] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0165] The above description is merely a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application.
Claims
1. An information processing method, characterized in that: Applied to an information processing device, the method includes: Calling a static resource acquisition method to receive at least one sub-application information transmitted by a client; and obtaining at least one resource location address corresponding to at least one sub-application from the at least one sub-application information; Using the static resource acquisition method, sending at least one static resource acquisition request corresponding to the at least one resource location address to the server during an idle time period; When the static resource acquisition method receives response information sent by the server based on the at least one static resource acquisition request, acquiring at least one hypertext address corresponding to the at least one sub-application from the response information; Obtain at least one hypertext message at the at least one hypertext address, and convert the at least one hypertext message into at least one group of elements; Screening out a first group of static elements from a first group of elements in the at least one group of elements, until at least one group of static elements is screened out from the at least one group of elements; wherein screening out the first group of static elements from the first group of elements in the at least one group of elements includes: Filtering target elements from the first group of elements according to preset static resource attributes; Obtaining static resource information corresponding to the target element; Adjusting the target tag of the target element using the static resource information to obtain the first group of static elements; Upon receiving a target rendering instruction of a target sub-application in the at least one sub-application, a target group static element corresponding to the target sub-application is obtained from the at least one group of static elements, and the target group static element is loaded into the base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application.
2. The method according to claim 1, characterized in that The acquiring, from the at least one sub-application information, at least one resource location address corresponding to the at least one sub-application further includes: At least one sub-application identifier corresponding to the at least one sub-application is obtained from the at least one sub-application information.
3. The method according to claim 1, characterized in that The target rendering instruction includes a target sub-application identifier of the target sub-application, and obtaining a target group static element corresponding to the target sub-application from the at least one group of static elements includes: Searching for a first identifier matching the target sub-application identifier in the at least one sub-application identifier; In the at least one group of static elements, the target group of static elements matching the first identifier is obtained.
4. The method according to claim 1, wherein The method further comprises: screening out a first group of static elements from a first group of elements in the at least one group of elements, and after screening out at least one group of static elements from the at least one group of elements, the method further comprises: When the sub-application to be processed is not an application in the at least one sub-application and a rendering instruction of the sub-application to be processed is received, obtaining a location address of a resource to be processed corresponding to the sub-application to be processed from the rendering instruction; According to the to-be-processed resource location address, a request is made to the server for the to-be-processed static element corresponding to the to-be-processed sub-application.
5. The method according to claim 1, wherein The step of filtering the target element from the first group of elements according to the preset static resource attribute includes: Obtaining a first set of element tags and a first set of address attributes corresponding to the first set of elements; When the first tag in the first group of element tags is a connection tag or a script tag, and there is a first address attribute corresponding to the first tag, it is determined that the element corresponding to the first tag is the target element, the first tag is a partial tag in the first group of element tags, and the first address attribute is a partial address attribute in the first group of address attributes.
6. The method according to claim 5, characterized in that The step of determining, when the first tag in the first group of element tags is a connection tag or a script tag and a first address attribute corresponding to the first tag exists, that the element corresponding to the first tag is the target element includes: When the first tag in the first group of element tags is a script tag and the first address attribute corresponding to the first tag exists, determining that the element corresponding to the first tag is the target element; In a case where the first tag in the first group of element tags is a connection tag, detecting the first address attribute and the element attribute of the element corresponding to the first tag; In a case where the element attribute is a string attribute and the first address attribute exists, it is determined that the element corresponding to the first tag is the target element.
7. The method according to claim 1, characterized in that Before obtaining the static resource information corresponding to the target element, the method further includes: Obtaining the first address attribute corresponding to the target element; Obtaining the element address of the target element according to the first address attribute; Correspondingly, obtaining the static resource information corresponding to the target element includes: Obtain the static resource information pointed to by the element address.
8. The method according to claim 1, characterized in that Before adjusting the target tag of the target element by using the static resource information to obtain the first group of static elements, the method further includes: Create the current tag; Accordingly, the step of adjusting the target tag of the target element by using the static resource information to obtain the first group of static elements includes: Inserting the static resource information into the current tag to obtain an updated current tag; The target tag is replaced with the updated current tag to obtain the first group of static elements.
9. An information processing device, characterized in that The device comprises: a receiving unit configured to call a static resource acquisition method to receive at least one sub-application information transmitted by a client; and upon receiving a target rendering instruction of a target sub-application in the at least one sub-application, obtain a target group of static elements corresponding to the target sub-application from the at least one group of static elements; A sending unit, configured to send at least one static resource acquisition request corresponding to the at least one resource location address to a server during an idle time period using the static resource acquisition method; an acquiring unit, configured to, when the static resource acquisition method receives response information sent by the server based on the at least one static resource acquisition request, acquire at least one hypertext address corresponding to the at least one sub-application from the response information; and acquire at least one hypertext information from the at least one hypertext address; a conversion unit, configured to convert the at least one hypertext information into at least one group of elements; A screening unit, configured to screen out a first group of static elements from a first group of elements in the at least one group of elements, until at least one group of static elements is screened out from the at least one group of elements; wherein screening out the first group of static elements from the first group of elements in the at least one group of elements comprises: screening a target element from the first group of elements according to a preset static resource attribute; obtaining static resource information corresponding to the target element; and adjusting a target tag of the target element using the static resource information to obtain the first group of static elements; An adding unit is used to load the target group static elements into a base application corresponding to the target sub-application to obtain a micro front-end corresponding to the target sub-application.
10. An information processing device, characterized in that: The device comprises: A memory, a processor, and a communication bus, wherein the memory communicates with the processor via the communication bus, the memory stores an information processing program executable by the processor, and when the information processing program is executed, the method according to any one of claims 1 to 8 is performed by the processor.
11. A storage medium having a computer program stored thereon, applied to an information processing device, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Method and system for pre-fetching web page, and method for accessing web page
CN102438045A
Low latency applications using multiple servers
US20170279869A1