A page loading method and device, electronic equipment and storage medium
By allocating a page loading thread and a file reference thread during the page loading process to handle the retrieval and rendering of JS files, the problem of blank pages caused by network instability was solved, improving page loading efficiency and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DAWNING INFORMATION IND (BEIJING) CO LTD
- Filing Date
- 2022-10-19
- Publication Date
- 2026-06-23
Smart Images

Figure CN115630245B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a page loading method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of computer technology, the elements on software pages are becoming increasingly rich, and page development technology is playing an increasingly important role in the entire software development process.
[0003] In existing page loading technologies, in order to reduce the amount of code on the page and optimize the page's cleanliness, a JavaScript (lightweight programming language, JS) file is usually included in the page loading function. The page rendering process is completed by running the business logic code in the JS file.
[0004] However, some of the JS files included in the page load function are third-party files, and the inclusion of these files is highly dependent on network conditions. When JS files are used at the top level, an unstable network connection can cause them to fail to be referenced or downloaded to the local machine. This can result in a blank page, negatively impacting the user experience. Summary of the Invention
[0005] This invention provides a page loading method, apparatus, electronic device, and storage medium, which can improve page loading efficiency and enhance the user's software experience.
[0006] According to one aspect of the present invention, a page loading method is provided, comprising:
[0007] During the loading process of the target page, multiple page elements corresponding to the target page are loaded through the page loading thread, and the identification information of the JS file to be referenced is passed to the file referencing thread;
[0008] The file referencing thread retrieves the JS file corresponding to the target page based on the identification information, and passes the retrieval result of the JS file to the page loading thread.
[0009] The page loading thread renders the multiple page elements based on the retrieval results of the JS file to complete the loading of the target page.
[0010] Optionally, the retrieved result corresponding to the JS file is passed to the page loading thread, including:
[0011] The file reference thread is used to determine whether the JS file was successfully retrieved within a preset time period.
[0012] If so, the successfully retrieved JS file and the first business logic function corresponding to the JS file will be passed to the page loading thread through the file referencing thread.
[0013] Optionally, the page loading thread renders the multiple page elements based on the retrieved result corresponding to the JS file, including:
[0014] If the obtained result includes a JS file and a first business logic function corresponding to the JS file, then the page loading thread renders the multiple page elements according to the business logic code in the JS file and the first business logic function.
[0015] Optionally, after determining whether the JS file has been successfully retrieved within a preset time period via the file referencing thread, the method further includes:
[0016] If not, the second business logic function corresponding to the failed JS file will be passed to the page loading thread via the file reference thread.
[0017] Optionally, the page loading thread renders the multiple page elements based on the retrieved result corresponding to the JS file, including:
[0018] If the obtained result includes a second business logic function corresponding to a failed JS file, then the page loading thread renders the multiple page elements according to the second business logic function.
[0019] Optionally, the file referencing thread passes the successfully retrieved JS file and the first business logic function corresponding to the JS file to the page loading thread, including:
[0020] The file referencing thread passes the successfully acquired JS file, the first business logic function corresponding to the JS file, and the identification information of the JS file to the page loading thread.
[0021] Optionally, after passing the successfully obtained JS file and the first business logic function corresponding to the JS file to the page loading thread through the file referencing thread, the method further includes:
[0022] The page loading thread updates the JS file to a local JS file that matches the development environment of the target page, based on the executable file corresponding to the target page.
[0023] The page loading thread renders the multiple page elements based on the business logic code in the JS file and the first business logic function, including:
[0024] The page loading thread renders the multiple page elements based on the business logic code in the local JS file and the first business logic function.
[0025] According to another aspect of the present invention, a page loading apparatus is provided, the apparatus comprising:
[0026] The identifier passing module is used to load multiple page elements corresponding to the target page through the page loading thread during the loading process of the target page, and pass the identifier information of the JS file to be referenced to the file referencing thread;
[0027] The file acquisition module is used to acquire the JS file corresponding to the target page according to the identification information through the file reference thread, and pass the acquisition result of the JS file to the page loading thread.
[0028] The page rendering module is used to render the multiple page elements according to the acquisition results corresponding to the JS file through the page loading thread, so as to complete the loading of the target page.
[0029] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0030] At least one processor; and
[0031] A memory communicatively connected to the at least one processor; wherein,
[0032] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the page loading method according to any embodiment of the present invention.
[0033] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the page loading method according to any embodiment of the present invention.
[0034] The technical solution provided by this invention, during the loading process of the target page, involves the page loading thread loading multiple page elements corresponding to the target page and passing the identification information of the JS file to be referenced to the file referencing thread. The file referencing thread retrieves the JS file based on the identification information and passes the retrieval result to the page loading thread. The page loading thread then renders multiple page elements based on the retrieval result to complete the loading of the target page. This technical approach avoids situations where the page is blank for a long time during the loading process. Regardless of whether the JS file is successfully referenced or not, the page loading thread will process it according to the corresponding business logic, avoiding the blocking of the entire page loading due to JS file reference delays, reducing page loading time, and improving page loading efficiency. It allows the page loading thread to quickly render the corresponding business system on the page based on the identification information of the JS file. By updating the JS file to a local JS file that matches the development environment of the target page, it can prevent stuttering during page loading.
[0035] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a flowchart of a page loading method provided according to an embodiment of the present invention;
[0038] Figure 2 This is a flowchart of another page loading method provided according to an embodiment of the present invention;
[0039] Figure 3 This is a flowchart of another page loading method provided according to an embodiment of the present invention;
[0040] Figure 4 This is a schematic diagram of the structure of a page loading device according to an embodiment of the present invention;
[0041] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the page loading method of this invention. Detailed Implementation
[0042] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0043] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0044] Figure 1 This is a flowchart illustrating a page loading method provided in an embodiment of the present invention. This embodiment is applicable to loading software interfaces. The method can be executed by a page loading device, which can be implemented in hardware and / or software. This page loading device can be configured in an electronic device (e.g., a terminal or server) with data processing capabilities. Figure 1 As shown, the method includes:
[0045] Step 110: During the loading process of the target page, load multiple page elements corresponding to the target page through the page loading thread, and pass the identification information of the JS file to be referenced to the file reference thread.
[0046] In this embodiment, the target page can be the display interface of a software product. The software product can be an application (APP) installed on a mobile smart device or software installed on a computer. Optionally, a page loading thread and a file referencing thread can be pre-established before the target page is loaded. The page loading thread is used to load multiple page elements from the target page and render these elements. The file referencing thread is used to reference the JS file associated with the target page.
[0047] In one specific embodiment, the JS file may include business logic code commonly used in the page rendering process. The thread can be understood as the control flow capable of scheduling operations in the operating system of an electronic device. The page elements can be text, images, audio, animations, and videos on the target page.
[0048] Optionally, during this step, when loading the target page, multiple page elements can be loaded using the page loading thread according to the Document Object Model (DOM) interface. Simultaneously, the identification information of the JS file associated with the target page (i.e., the JS file to be referenced) can be passed to the file referencing thread. Specifically, the identification information can be the filename of the JS file.
[0049] Step 120: Using the file reference thread, obtain the JS file corresponding to the target page based on the identification information, and pass the result of obtaining the JS file to the page loading thread.
[0050] In this embodiment, after receiving the identification information of the JS file, the file referencing thread can obtain the JS file corresponding to the target page according to the identification information and the preset acquisition instruction (e.g., jQuery.getScript), and pass the acquisition result of the JS file to the page loading thread.
[0051] Specifically, if the file referencing thread successfully retrieves the JS file, the corresponding retrieval result can be the successfully retrieved JS file; conversely, if the file referencing thread fails to retrieve the JS file, the retrieval result can be a failure instruction.
[0052] Step 130: Using the page loading thread, render the multiple page elements according to the acquisition result corresponding to the JS file to complete the loading of the target page.
[0053] In this embodiment, optionally, after the page loading thread receives the JS file acquisition result, it can render multiple page elements according to the preset business logic function that matches the acquisition result to complete the loading of the target page.
[0054] In one specific embodiment, if the obtained result is a JS file, multiple page elements can be rendered according to the business logic code in the JS file; if the obtained result is a failure instruction, multiple page elements can be rendered according to a preset business logic function that matches the failure instruction.
[0055] In this embodiment, by distributing page rendering operations and JS file referencing operations on two different threads, the situation where the page loading thread references the JS file and the page remains blank for a long time due to network instability, as is the case in the prior art, can be avoided. Secondly, by having the page loading thread render multiple page elements based on the JS file retrieval result, the page loading thread can process the corresponding business logic regardless of whether the JS file reference is successful or not, avoiding the blocking of the entire page loading due to JS file reference delay, thereby reducing page loading time and improving page loading efficiency.
[0056] In this embodiment, during the loading process of the target page, the page loading thread loads multiple page elements corresponding to the target page and passes the identification information of the JS file to be referenced to the file referencing thread. The file referencing thread obtains the JS file according to the identification information and passes the obtained result of the JS file to the page loading thread. The page loading thread renders multiple page elements according to the obtained result of the JS file to complete the loading of the target page. This technical means can avoid the situation where the page is blank for a long time during the loading process of the target page, improve the page loading efficiency, and enhance the user's software experience.
[0057] Figure 2 A flowchart of another page loading method provided in an embodiment of the present invention is shown below. Figure 2 As shown, the method includes:
[0058] Step 210: During the loading process of the target page, load multiple page elements corresponding to the target page through the page loading thread, and pass the identification information of the JS file to be referenced to the file reference thread.
[0059] Step 220: Obtain the JS file corresponding to the target page through the file reference thread based on the identification information.
[0060] Step 230: Using the file reference thread, determine whether the JS file was successfully retrieved within a preset time period. If yes, proceed to steps 240-250; otherwise, proceed to steps 260-270.
[0061] In this embodiment, after the file referencing thread receives the identification information of the JS file, it can set a corresponding timer according to a preset duration and start the timer. Then, it can determine whether the JS file has been successfully obtained within the time period set by the timer.
[0062] The duration can be set to 5 seconds, and the specific value can be preset according to the actual situation. This embodiment does not impose any restrictions on this.
[0063] Step 240: The successfully obtained JS file and the first business logic function corresponding to the JS file are passed to the page loading thread through the file reference thread.
[0064] In this embodiment, if the file referencing thread successfully retrieves the JS file within a preset time period, it can edit the business logic (i.e., the first business logic function) after the JS file is successfully referenced, and pass the successfully retrieved JS file and the first business logic function to the page loading thread.
[0065] The first business logic function is used to instruct the page loading thread to generate a page architecture that matches various page elements based on the JS file, such as the style, display method, and layout position of each element in the target page.
[0066] Step 250: Render the multiple page elements using the page loading thread, based on the business logic code in the JS file and the first business logic function.
[0067] In this embodiment, if the result received by the page loading thread includes a JS file and a first business logic function, the page loading thread can render the multiple page elements according to the business logic code in the JS file and the first business logic function.
[0068] In one specific embodiment, after the page loading thread receives the JS file, it can run the business logic code and the first business logic function in the JS file to render multiple page elements.
[0069] Step 260: Through the file reference thread, the second business logic function corresponding to the failed JS file is passed to the page loading thread.
[0070] In this embodiment, if the file referencing thread fails to retrieve the JS file within a preset time period, the business logic (i.e., the second business logic function) after the JS file reference failure can be edited and passed to the page loading thread.
[0071] The second business logic function is used to instruct the page loading thread to generate a page structure that matches each page element according to the processing logic in the second business logic function.
[0072] In one specific embodiment, in order to mark the result of obtaining the JS file, after the file referencing thread sets a timer, the status variable flag of the JS file can be set to false. If the JS file is successfully obtained within the time period set by the timer, the variable flag is set to true; if the JS file is not obtained within the time period set by the timer, the variable flag is kept as false.
[0073] Step 270: Render the multiple page elements according to the second business logic function.
[0074] In this embodiment, if the result received by the page loading thread includes a second business logic function, the page loading thread can render the multiple page elements according to the second business logic function.
[0075] In one specific embodiment, after receiving the second business logic, the page loading thread can run the second business logic function to render multiple page elements.
[0076] In this embodiment, by using a file referencing thread to edit the business logic functions corresponding to different results obtained from the JS file, the page loading thread can be instructed to quickly obtain different page processing logic, thereby reducing page loading time and improving page loading efficiency.
[0077] The technical solution provided by this invention loads multiple page elements corresponding to a target page through a page loading thread, and passes the identification information of the JS file to be referenced to a file referencing thread. The file referencing thread retrieves the JS file based on the identification information and determines whether the JS file has been successfully retrieved within a preset time period. If so, the file referencing thread passes the successfully retrieved JS file and a first business logic function to the page loading thread. The page loading thread then renders the multiple page elements based on the business logic code in the JS file and the first business logic function. If not, the file referencing thread passes a second business logic function to the page loading thread, and the second business logic function is used to render the multiple page elements. This technical approach can improve page loading efficiency and enhance the user experience of the software.
[0078] Figure 3 A flowchart of another page loading method provided in an embodiment of the present invention is shown below. Figure 3 As shown, the method includes:
[0079] Step 310: During the loading process of the target page, load multiple page elements corresponding to the target page through the page loading thread, and pass the identification information of the JS file to be referenced to the file reference thread.
[0080] Step 320: Obtain the JS file corresponding to the target page based on the identification information through the file reference thread.
[0081] Step 330: Using the file reference thread, determine whether the JS file was successfully retrieved within a preset time period. If yes, proceed to steps 340-360; otherwise, proceed to steps 370-380.
[0082] Step 340: Through the file referencing thread, the successfully obtained JS file, the first business logic function corresponding to the JS file, and the identification information of the JS file are passed to the page loading thread.
[0083] In this embodiment, if the file referencing thread successfully retrieves the JS file within a preset time period, it can pass the successfully retrieved JS file, the first business logic function, and the JS file's identification information to the page loading thread. The identification information can be the system identifier of the business system corresponding to the JS file.
[0084] In one specific embodiment, assuming the file referencing thread retrieves a JS file from the announcement system on the page, the identifier information of the JS file can be set to "GongGao". The advantage of this setting is that it allows the page loading thread to quickly render the corresponding business system on the page based on the JS file's identifier information, thereby improving page loading efficiency.
[0085] Step 350: Through the page loading thread, update the JS file to a local JS file that matches the development environment of the target page, based on the executable file corresponding to the target page.
[0086] In this embodiment, since most of the JS files obtained by the file referencing thread are third-party files, in order to avoid the page loading thread from laging when running the JS files, the page loading thread can update the JS files to local JS files that match the target page development environment based on the tags in the target page's executable file (Script).
[0087] Among them, the Script file can be a page script file written using a specific descriptive language and according to a certain format.
[0088] The advantage of this setup is that by updating the JS file to a local JS file that matches the target page's development environment, page loading stutters can be avoided, thereby reducing page loading time and improving page loading efficiency.
[0089] Step 360: Render the multiple page elements using the page loading thread, based on the business logic code in the local JS file and the first business logic function.
[0090] In this step, after the page loading thread generates a local JS file, it can run the business logic code and the first business logic function in the local JS file to render multiple page elements.
[0091] Step 370: Through the file reference thread, the second business logic function corresponding to the failed JS file is passed to the page loading thread.
[0092] Step 380: Render the multiple page elements according to the second business logic function.
[0093] The technical solution provided by this invention loads multiple page elements corresponding to a target page through a page loading thread, and passes the identification information of the JS file to be referenced to a file referencing thread. The file referencing thread retrieves the JS file based on the identification information and determines whether the JS file was successfully retrieved within a preset time period. If so, the file referencing thread passes the successfully retrieved JS file, a first business logic function, and the JS file identification information to the page loading thread, which generates a local JS file. Based on the business logic code in the local JS file and the first business logic function, multiple page elements are rendered. If not, the file referencing thread passes a second business logic function to the page loading thread, and multiple page elements are rendered based on the second business logic function. This technical approach can improve page loading efficiency and enhance the user experience of the software.
[0094] Figure 4 This is a schematic diagram of the structure of a page loading device provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the device includes: an identifier transmission module 410, a file acquisition module 420, and a page rendering module 430.
[0095] The identifier passing module 410 is used to load multiple page elements corresponding to the target page through the page loading thread during the loading process of the target page, and to pass the identifier information of the JS file to be referenced to the file referencing thread.
[0096] The file acquisition module 420 is used to acquire the JS file corresponding to the target page according to the identification information through the file reference thread, and to pass the acquisition result of the JS file to the page loading thread.
[0097] The page rendering module 430 is used to render the multiple page elements according to the acquisition result corresponding to the JS file through the page loading thread, so as to complete the loading of the target page.
[0098] The technical solution provided by this invention, during the loading process of the target page, involves the page loading thread loading multiple page elements corresponding to the target page, and passing the identification information of the JS file to be referenced to the file referencing thread. The file referencing thread then retrieves the JS file based on the identification information and passes the retrieval result corresponding to the JS file to the page loading thread. The page loading thread then renders multiple page elements based on the retrieval result corresponding to the JS file, thereby completing the loading of the target page. This technical approach avoids situations where the page is blank for a long time during the loading process, improves page loading efficiency, and enhances the user's software experience.
[0099] Based on the above embodiments, the file acquisition module 420 includes:
[0100] The judgment unit is used to determine, through the file reference thread, whether the JS file has been successfully obtained within a preset time period;
[0101] The first function passing unit is used to pass the successfully obtained JS file and the first business logic function corresponding to the JS file to the page loading thread when the file referencing thread successfully obtains the JS file within a preset time period.
[0102] The second function passing unit is used to pass the second business logic function corresponding to the failed JS file to the page loading thread when the file referencing thread fails to retrieve the JS file within a preset time period.
[0103] The identification processing unit is used to pass the successfully acquired JS file, the first business logic function corresponding to the JS file, and the identification information of the JS file to the page loading thread through the file reference thread;
[0104] The file update unit is used to update the JS file to a local JS file that matches the development environment of the target page, based on the executable file corresponding to the target page, through the page loading thread.
[0105] The page rendering module 430 includes:
[0106] The first rendering unit is configured to render the multiple page elements by means of the page loading thread, based on the business logic code in the JS file and the first business logic function, if the obtained result includes a JS file and a first business logic function corresponding to the JS file.
[0107] The second rendering unit is used to render the multiple page elements according to the second business logic function through the page loading thread if the acquisition result includes the second business logic function corresponding to the failed JS file.
[0108] The page element rendering unit is used to render the multiple page elements through the page loading thread, based on the business logic code in the local JS file and the first business logic function.
[0109] The above-described apparatus can execute the methods provided in all the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above methods. Technical details not described in detail in the embodiments of the present invention can be found in the methods provided in all the foregoing embodiments of the present invention.
[0110] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0111] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0112] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0113] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the page loading method.
[0114] In some embodiments, the page loading method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the page loading method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the page loading method by any other suitable means (e.g., by means of firmware).
[0115] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0116] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0117] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0118] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0119] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0120] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0121] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0122] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A page loading method, characterized in that, include: During the loading process of the target page, multiple page elements corresponding to the target page are loaded through the page loading thread, and the identification information of the JS file to be referenced is passed to the file referencing thread; The file referencing thread retrieves the JS file corresponding to the target page based on the identification information, and passes the retrieval result of the JS file to the page loading thread. The page loading thread renders the multiple page elements based on the retrieval results corresponding to the JS file to complete the loading of the target page. Before the target page is loaded, the following is also included: A page loading thread and a file referencing thread are pre-established; the page loading thread is used to load multiple page elements in the target page and render the multiple page elements, and the file referencing thread is used to reference the JS file associated with the target page. The step of passing the retrieval result corresponding to the JS file to the page loading thread includes: The file reference thread is used to determine whether the JS file was successfully retrieved within a preset time period. If so, the successfully retrieved JS file and the first business logic function corresponding to the JS file will be passed to the page loading thread through the file referencing thread; If not, the second business logic function corresponding to the failed JS file is passed to the page loading thread through the file referencing thread; wherein, the first business logic function is used to instruct the page loading thread to generate a page structure that matches each page element according to the JS file, and the second business logic function is used to instruct the page loading thread to generate a page structure that matches each page element according to the processing logic in the second business logic function.
2. The method according to claim 1, characterized in that, The page loading thread renders the multiple page elements based on the retrieved results from the JS file, including: If the obtained result includes a JS file and a first business logic function corresponding to the JS file, then the page loading thread renders the multiple page elements according to the business logic code in the JS file and the first business logic function.
3. The method according to claim 1, characterized in that, The page loading thread renders the multiple page elements based on the retrieved results from the JS file, including: If the obtained result includes a second business logic function corresponding to a failed JS file, then the page loading thread renders the multiple page elements according to the second business logic function.
4. The method according to claim 1, characterized in that, The file referencing thread passes the successfully retrieved JS file and its corresponding first business logic function to the page loading thread, including: The file referencing thread passes the successfully acquired JS file, the first business logic function corresponding to the JS file, and the identification information of the JS file to the page loading thread.
5. The method according to claim 2, characterized in that, After passing the successfully retrieved JS file and the corresponding first business logic function to the page loading thread via the file referencing thread, the process further includes: The page loading thread updates the JS file to a local JS file that matches the development environment of the target page, based on the executable file corresponding to the target page. The page loading thread renders the multiple page elements based on the business logic code in the JS file and the first business logic function, including: The page loading thread renders the multiple page elements based on the business logic code in the local JS file and the first business logic function.
6. A page loading device, characterized in that, include: The identifier passing module is used to load multiple page elements corresponding to the target page through the page loading thread during the loading process of the target page, and pass the identifier information of the JS file to be referenced to the file referencing thread; The file acquisition module is used to acquire the JS file corresponding to the target page according to the identification information through the file reference thread, and pass the acquisition result of the JS file to the page loading thread. The page rendering module is used to render the multiple page elements according to the acquisition result corresponding to the JS file through the page loading thread, so as to complete the loading of the target page; Before the target page is loaded, the following is also included: A page loading thread and a file referencing thread are pre-established; the page loading thread is used to load multiple page elements in the target page and render the multiple page elements, and the file referencing thread is used to reference the JS file associated with the target page. The file acquisition module includes: The judgment unit is used to determine, through the file reference thread, whether the JS file has been successfully obtained within a preset time period; The first function passing unit is used to pass the successfully obtained JS file and the first business logic function corresponding to the JS file to the page loading thread when the file referencing thread successfully obtains the JS file within a preset time period. The second function passing unit is used to pass the second business logic function corresponding to the failed JS file to the page loading thread when the file referencing thread fails to retrieve the JS file within a preset time period. The first business logic function is used to instruct the page loading thread to generate a page structure that matches the various page elements based on the JS file, and the second business logic function is used to instruct the page loading thread to generate a page structure that matches the various page elements based on the processing logic in the second business logic function.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the page loading method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the page loading method of any one of claims 1-5.