CN110865852B - Webpage component loading method and device, electronic equipment and storage medium - Google Patents

Webpage component loading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110865852B
CN110865852B CN201911134881.5A CN201911134881A CN110865852B CN 110865852 B CN110865852 B CN 110865852B CN 201911134881 A CN201911134881 A CN 201911134881A CN 110865852 B CN110865852 B CN 110865852B
Authority
CN
China
Prior art keywords
component
loaded
loading
dependency information
directly dependent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911134881.5A
Other languages
Chinese (zh)
Other versions
CN110865852A (en
Inventor
蒋圣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201911134881.5A priority Critical patent/CN110865852B/en
Publication of CN110865852A publication Critical patent/CN110865852A/en
Application granted granted Critical
Publication of CN110865852B publication Critical patent/CN110865852B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure discloses a loading method, a loading device, electronic equipment and a storage medium of a webpage component, wherein the method comprises the following steps: acquiring dependency information of a component to be loaded; loading the component to be loaded according to the dependency information of the component to be loaded, comprising: if the loading mark is loaded, omitting the loading; if the loading mark is not loaded and the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading the code according to the code downloading address and modifying the loading mark into loaded; if the loading mark is not loaded and the directly-dependent component is not empty, loading the code according to the code downloading address, and respectively returning the directly-dependent component as the component to be loaded to execute the steps until the loading marks of all the directly-dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded. The method can avoid the data packet bloated caused by loading repeated codes and can improve the loading speed.

Description

Webpage component loading method and device, electronic equipment and storage medium
Technical Field
The embodiment of the disclosure relates to the field of network communication, in particular to a loading method and device of a webpage component, electronic equipment and a storage medium.
Background
When front-end development is performed, a modularized development mode is generally adopted, and complex dependency relationship is often formed among components. Many components may be repeatedly loaded and compiled in one application because they are repeatedly relied upon. For example, when an application or a component needs to load a component C and a component D, the components that they depend on may cross, for example, when the component C and the component D depend on the component a and the component B, both the component a and the component B may be loaded when the component C and the component D are loaded, which results in repeated loading of the components, not only makes the data packet bulky, but also reduces the loading speed.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a storage medium for loading a web page component, so as to avoid loading repeated codes to make data packets bulky.
Other features and advantages of embodiments of the present disclosure will be apparent from the following detailed description, or may be learned by practice of embodiments of the disclosure in part.
In a first aspect, an embodiment of the present disclosure provides a method for loading a web page component, including:
obtaining dependency information of a component to be loaded, wherein the dependency information comprises a loading mark for identifying whether the component has been loaded, a code download address and a directly dependent component;
If the loading mark is loaded, omitting loading the component to be loaded;
if the loading mark is not loaded, loading the component to be loaded according to the dependency information, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading addresses, and modifying the loading marks into loaded;
if the directly dependent component is not empty, loading codes according to the code downloading address, and respectively returning the directly dependent component as a component to be loaded to execute the step of acquiring the dependent information and the step of loading the component according to the dependent information until the loading marks of all directly dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded.
In a second aspect, an embodiment of the present disclosure further provides a loading device for a web page component, including:
a dependency information acquisition unit configured to acquire dependency information of a component to be loaded, wherein the dependency information includes a load flag for identifying whether or not the component has been loaded, a code download address, and a component directly dependent;
the first loading unit is used for omitting loading the component to be loaded if the loading mark is loaded;
The second loading unit is configured to load the component to be loaded according to the dependency information if the loading flag is unloaded, and includes:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading addresses, and modifying the loading marks into loaded;
if the directly dependent component is not empty, loading codes according to the code downloading address, respectively taking the directly dependent component as a component to be loaded, acquiring the dependent information through the dependent information acquisition unit, and loading through the first loading unit and the second loading unit until the loading marks of all directly dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the instructions of the method of any of the first aspects.
In a fourth aspect, the presently disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method according to any of the first aspects.
The technical scheme provided by the embodiment of the disclosure has the beneficial technical effects that:
according to the embodiment of the disclosure, by recording the dependency information (including the loading mark, the code download address and the directly dependent components) of each component, the component to be loaded is loaded according to the dependency information of the component to be loaded, so that the data packet is prevented from being bulked caused by loading repeated codes, and the loading speed can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following description will briefly explain the drawings required to be used in the description of the embodiments of the present disclosure, and it is apparent that the drawings in the following description are only some of the embodiments of the present disclosure, and other drawings may be obtained according to the contents of the embodiments of the present disclosure and these drawings without inventive effort for those skilled in the art.
FIG. 1 is a flowchart illustrating a method for loading a web page component according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating another method for loading a web page component according to an embodiment of the present disclosure;
FIG. 3 is a schematic structural diagram of a loading device for a web page component according to an embodiment of the present disclosure;
FIG. 4 is a schematic structural diagram of another loading device for web page components according to an embodiment of the present disclosure;
FIG. 5 is a schematic structural diagram of a loading device for a web page component according to another embodiment of the present disclosure;
fig. 6 shows a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
In order to make the technical problems solved, the technical solutions adopted and the technical effects achieved by the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described in further detail below with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments, but not all embodiments of the present disclosure. All other embodiments, which are derived by a person skilled in the art from the embodiments of the present disclosure without creative efforts, fall within the protection scope of the embodiments of the present disclosure.
It should be noted that the terms "system" and "network" in the embodiments of the present disclosure are often used interchangeably herein. References to "and/or" in the embodiments of the present disclosure are intended to encompass any and all combinations of one or more of the associated listed items. The terms first, second and the like in the description and in the claims and drawings are used for distinguishing between different objects and not for limiting a particular order.
It should be further noted that, in the embodiments of the present disclosure, the following embodiments may be implemented separately, or may be implemented in combination with each other, which is not specifically limited by the embodiments of the present disclosure.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The technical solutions of the embodiments of the present disclosure are further described below with reference to the accompanying drawings and through specific implementations.
Fig. 1 is a flowchart illustrating a method for loading a web page component according to an embodiment of the present disclosure, where the method may be applicable to a case of loading a web page component, and may be performed by a loading device of a web page component configured in an electronic device, and as shown in fig. 1, the method for loading a web page component according to the embodiment includes:
in step S110, dependency information of a component to be loaded is acquired.
Wherein the dependency information includes at least a load flag identifying whether it has been loaded, a code download address, and a component of direct dependency.
The embodiment of the specific record form of the dependency information of the component is not limited, for example, each component may store its dependency information by using a JSON key VALUE pair, where the key is a component name or a component identifier, and the VALUE includes: load tag, code download address URL, directly dependent component name or component identification, etc.
In step S120, it is determined whether the loading flag is loaded, if yes, the process is ended, otherwise, step S130 is executed.
If the loading of the component to be loaded is marked as loaded, the component to be loaded is already loaded, so that the loading of the component to be loaded is omitted, and repeated loading is avoided.
In step S130, it is determined whether the directly dependent component is empty or the load flag is loaded, if yes, step S140 is executed, otherwise step S150 is executed.
In step S140, the code is loaded according to the code download address, and the load flag is modified to be loaded.
In step S150, the code is loaded according to the code download address, and the directly dependent components are used as components to be loaded, respectively.
Before the web page is online, the loading marks in the dependent information of the related components are unloaded, the dependent information of the components to be loaded related to the web page can be traversed, and the loading marks in the dependent information are uniformly set to be unloaded respectively. In order to omit the step of determining the relevant components to be loaded, the loading flag in the dependency information of all components may be made unloaded.
It should be noted that, before obtaining the dependency information of the component to be loaded, the component to be loaded needs to be determined.
If loading and packaging are carried out before online, the topmost component of the component dependency relationship is mainly determined as a component to be loaded, so that the dependent components are loaded layer by layer.
The component to be loaded can be given or calculated, for example, by the following method:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded. For example, traversing the dependency information of the associated component set, and deleting the directly dependent component in the dependency information from the associated component set if the directly dependent component belongs to the associated component set; and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
After loading is finished, if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after loading is finished with the new code; if the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
According to the embodiment, by recording the dependency information (including the loading mark, the code downloading address and the directly dependent components) of each component, the component to be loaded is loaded according to the dependency information of the component to be loaded, so that the data packet is prevented from being bloated caused by loading repeated codes, and the loading speed can be improved.
Fig. 2 is a flow chart illustrating another loading method of a web page component according to an embodiment of the present disclosure, where the embodiment is improved and optimized based on the foregoing embodiment. As shown in fig. 2, the loading method of the web page component according to the embodiment includes:
in step S210, dependency information of a component to be loaded is acquired.
In step S220, a version number to be loaded of the component to be loaded is obtained.
I.e. which version of the component to be loaded needs to be loaded.
In step S230, it is determined whether the directly dependent component is empty or the load flag is loaded, if yes, the process is ended, otherwise, step S240 is executed.
In step S240, it is determined whether the directly dependent component is empty, if so, step S250 is executed, otherwise step S260 is executed.
In step S250, the code is loaded according to the code download address corresponding to the version number to be loaded, and the loading mark corresponding to the version number to be loaded is modified to be loaded.
In step S260, the code is loaded according to the code download address corresponding to the version number to be loaded, and the directly dependent components corresponding to the version number are respectively used as the components to be loaded.
Further, before the web page is online, the dependent information of the components to be loaded related to the web page can be traversed, and loading marks in the dependent information are uniformly set to be unloaded respectively.
Further, before the dependency information of the component to be loaded is acquired, the component to be loaded can be determined by the following method:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded. For example, traversing the dependency information of the associated component set, and deleting the directly dependent component in the dependency information from the associated component set if the directly dependent component belongs to the associated component set; and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
Further, after loading is finished, if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after loading is finished with the new code; if the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
According to the method for loading the webpage component, on the basis of the previous embodiment, under the condition that each component has at least one version and the dependency information comprises the dependent component and the dependent version, the dependent information (comprising the loading mark, the code downloading address and the directly dependent component) of each component is recorded, the component to be loaded is loaded according to the dependent information of the component to be loaded and the version number to be loaded, so that the data package is prevented from being bloated due to repeated code loading, and the loading speed is improved.
As an implementation of the method shown in the foregoing figures, the present application provides an embodiment of a loading device for a web page component, and fig. 3 shows a schematic structural diagram of the loading device for a web page component provided in this embodiment, where an embodiment of the device corresponds to the embodiment of the method shown in fig. 1 and fig. 2, and the device may be specifically applied to various electronic devices. As shown in fig. 3, the loading device of the web page component according to the present embodiment includes a dependency information obtaining unit 310, a first loading unit 320, and a second loading unit 330.
The dependency information obtaining unit 310 is configured to obtain dependency information of a component to be loaded, wherein the dependency information includes a load flag for identifying whether the component has been loaded, a code download address, and a directly dependent component.
The first loading unit 320 is configured to omit loading the component to be loaded if the load flag is loaded.
The second loading unit 330 is configured to load the component to be loaded according to the dependency information if the load flag is not loaded, and includes:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading addresses, and modifying the loading marks into loaded;
if the directly dependent component is not empty, loading the code according to the code download address, and respectively taking the directly dependent component as a component to be loaded, acquiring the dependent information through the dependent information acquiring unit, and loading through the first loading unit 320 and the second loading unit 330 until the loading marks of all directly dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded.
Further, the device further includes an online preprocessing unit (not shown in fig. 3) configured to traverse the dependency information of the components to be loaded related to the web page before the web page is online, and uniformly set loading marks in the dependency information to be unloaded respectively.
The loading device of the webpage component provided by the embodiment can execute the loading method of the webpage component provided by the embodiment of the method, and has the corresponding functional modules and beneficial effects of the execution method.
As an implementation of the method shown in the foregoing figures, the present application provides an embodiment of another loading device for a web page component, and fig. 4 shows a schematic structural diagram of the loading device for a web page component provided in this embodiment, where the embodiment of the device corresponds to the embodiment of the method shown in fig. 1 and fig. 2, and the device may be specifically applied to various electronic devices. As shown in fig. 4, the loading device for a web page component according to the present embodiment includes a component to be loaded determining unit 410, a dependency information obtaining unit 420, a first loading unit 430, a second loading unit 440, and an updating unit 450.
The component to be loaded determining unit 410 is configured to determine the component to be loaded, including:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded.
The dependency information obtaining unit 420 is configured to obtain dependency information of a component to be loaded, wherein the dependency information includes a load flag for identifying whether the component has been loaded, a code download address, and a directly dependent component.
The first loading unit 430 is configured to omit loading the component to be loaded if the load flag is loaded.
The second loading unit 440 is configured to load the component to be loaded according to the dependency information if the load flag is not loaded, and includes:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading addresses, and modifying the loading marks into loaded;
if the directly dependent component is not empty, loading the code according to the code download address, and respectively taking the directly dependent component as a component to be loaded, acquiring the dependent information through the dependent information acquiring unit 420, and loading through the first loading unit 430 and the second loading unit 440 until the loading marks of all directly dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded.
The updating unit 450 is configured to, after ending the loading:
if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after the loading is finished with the new code;
If the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
Further, the component to be loaded determining unit 410 is configured to:
traversing the dependency information of the association component set, and deleting the directly dependent component from the association component set if the directly dependent component in the dependency information belongs to the association component set;
and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
The loading device of the webpage component provided by the embodiment can execute the loading method of the webpage component provided by the embodiment of the method, and has the corresponding functional modules and beneficial effects of the execution method.
As an implementation of the method shown in the foregoing figures, the present application provides an embodiment of a loading device for a web page component, and fig. 5 shows a schematic structural diagram of another loading device for a web page component provided in an embodiment of the present disclosure, as shown in fig. 5, where the loading device for a web page component in the embodiment includes a dependency information obtaining unit 510, a version number obtaining unit 520, a first loading unit 530, and a second loading unit 540.
The dependency information obtaining unit 510 is configured to obtain dependency information of a component to be loaded, wherein the dependency information includes a load flag for identifying whether the component has been loaded, a code download address, and a directly dependent component.
The loading marks comprise loading marks corresponding to at least one version number.
The code download address comprises a code download address corresponding to at least one version number.
The directly dependent components include at least one directly dependent component corresponding to a version number and a version number of the dependent component.
The version number obtaining unit 520 is configured to obtain a version number to be loaded of the component to be loaded before the component to be loaded is loaded according to the dependency information of the component to be loaded.
The first loading unit 530 is configured to omit loading the component to be loaded if the loading flag corresponding to the version number to be loaded is loaded;
the second loading unit 540 is configured to load the component to be loaded according to the dependency information and the version number to be loaded if the loading flag corresponding to the version number to be loaded is not loaded, including:
If the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code download address corresponding to the version number to be loaded, and modifying the loading marks corresponding to the version number to be loaded into loaded;
if the directly dependent component is not null, loading the code according to the code download address corresponding to the version number to be loaded, and taking the directly dependent component corresponding to the version number as the component to be loaded, acquiring the dependency information through the dependency information acquiring unit 510, acquiring the version number to be loaded through the version number acquiring unit 520, and loading through the first loading unit 530 and the second loading unit 540, until the loading marks corresponding to the version number to be loaded of all directly dependent components are loaded, and modifying the loading marks corresponding to the version to be loaded of the component to be loaded into loaded.
Further, the device further includes an online preprocessing unit (not shown in fig. 5) configured to traverse the dependency information of the components to be loaded related to the web page before the web page is online, and uniformly set loading marks in the dependency information to be unloaded respectively.
Further, the apparatus further includes a component to be loaded determining unit (not shown in fig. 5) for determining the component to be loaded before acquiring the dependency information of the component to be loaded, including:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded.
Further, the component to be loaded determining unit is configured to:
traversing the dependency information of the association component set, and deleting the directly dependent component from the association component set if the directly dependent component in the dependency information belongs to the association component set;
and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
Further, the apparatus further comprises an updating unit (not shown in fig. 5) for, after ending the loading:
if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after the loading is finished with the new code.
If the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
The loading device of the webpage component provided by the embodiment can execute the loading method of the webpage component provided by the embodiment of the method, and has the corresponding functional modules and beneficial effects of the execution method.
Referring now to fig. 6, a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 6 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 601.
It should be noted that, the computer readable medium described above in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the disclosed embodiments, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the disclosed embodiments, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
obtaining dependency information of a component to be loaded, wherein the dependency information comprises a loading mark for identifying whether the component has been loaded, a code download address and a directly dependent component;
loading the component to be loaded according to the dependency information of the component to be loaded, including:
if the loading mark is loaded, ending;
if the loading mark is not loaded and the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading address, modifying the loading mark into loaded and ending;
if the loading mark is not loaded and the directly dependent component is not empty, loading codes according to the code downloading address, respectively returning the directly dependent component as a component to be loaded to execute the step of acquiring the dependent information and the step of loading the component according to the dependent information until the loading marks of all directly dependent components are loaded, modifying the loading mark of the component to be loaded into loaded, and ending.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The name of the unit does not in any way constitute a limitation of the unit itself, for example the first acquisition unit may also be described as "unit acquiring at least two internet protocol addresses".
According to one or more embodiments of the present disclosure, the method for loading the web page component further includes traversing dependency information of the web page related component to be loaded, and respectively uniformly setting loading marks in the dependency information as unloaded before the web page is online.
According to one or more embodiments of the present disclosure, in the loading method of the web page component, before obtaining the dependency information of the component to be loaded, determining the component to be loaded further includes:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded.
According to one or more embodiments of the present disclosure, in the method for loading a web page component, obtaining at least one association component of the association component set that is not a directly dependent component of any association component includes:
Traversing the dependency information of the association component set, and deleting the directly dependent component from the association component set if the directly dependent component in the dependency information belongs to the association component set;
and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
According to one or more embodiments of the present disclosure, in the loading method of the web page component, after loading is finished, the method further includes:
if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after the loading is finished with the new code;
if the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
According to one or more embodiments of the present disclosure, in the loading method of the web page component:
the loading marks in the dependency information of the component comprise loading marks corresponding to at least one version number;
the code download address in the dependency information of the component comprises at least one code download address corresponding to the version number;
the directly dependent components in the dependency information of the components comprise directly dependent components corresponding to at least one version number and version numbers of the dependent components;
Before loading the component to be loaded according to the dependency information of the component to be loaded, acquiring a version number to be loaded of the component to be loaded;
loading the component to be loaded according to the dependency information of the component to be loaded comprises the following steps: and loading the component to be loaded according to the dependency information of the component to be loaded and the version number to be loaded.
According to one or more embodiments of the present disclosure, in the method for loading a web page component, loading the component to be loaded according to the dependency information and the version number to be loaded of the component to be loaded includes;
if the loading mark corresponding to the version number to be loaded is loaded, omitting loading the component to be loaded;
if the loading mark corresponding to the version number to be loaded is not loaded, loading the component to be loaded according to the dependency information and the version number to be loaded, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code download address corresponding to the version number to be loaded, and modifying the loading marks corresponding to the version number to be loaded into loaded;
and if the directly dependent component is not empty, loading codes according to the code download address corresponding to the version number to be loaded, and respectively returning the directly dependent component corresponding to the version number as the component to be loaded to execute the step of acquiring the dependency information, the step of acquiring the version number to be loaded and the step of loading the component according to the dependency information and the version number to be loaded until the loading marks corresponding to the version numbers to be loaded of all directly dependent components are loaded, and modifying the loading marks corresponding to the version to be loaded of the component to be loaded into loaded.
According to one or more embodiments of the present disclosure, the loading device of the web page component further includes an online preprocessing unit, configured to traverse the dependent information of the to-be-loaded component related to the web page before the web page is online, and uniformly set loading marks in the dependent information as unloaded, respectively.
According to one or more embodiments of the present disclosure, the loading device of the web page component further includes a component to be loaded determining unit, configured to determine the component to be loaded before obtaining the dependency information of the component to be loaded, including:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded.
According to one or more embodiments of the present disclosure, in the loading device of the web page component, the component to be loaded determining unit is configured to:
traversing the dependency information of the association component set, and deleting the directly dependent component from the association component set if the directly dependent component in the dependency information belongs to the association component set;
and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
According to one or more embodiments of the present disclosure, the loading device of the web page component further includes an updating unit configured to, after finishing loading:
if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after the loading is finished with the new code;
if the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
According to one or more embodiments of the present disclosure, in the loading device of the web page component:
the loading marks in the dependency information of the component comprise loading marks corresponding to at least one version number;
the code download address in the dependency information of the component comprises at least one code download address corresponding to the version number;
the directly dependent components in the dependency information of the components comprise directly dependent components corresponding to at least one version number and version numbers of the dependent components;
the device further comprises a version number acquisition unit, a version number judgment unit and a version number judgment unit, wherein the version number acquisition unit is used for acquiring the version number of the component to be loaded before the component to be loaded is loaded according to the dependency information of the component to be loaded;
The loading unit is used for: and loading the component to be loaded according to the dependency information of the component to be loaded and the version number to be loaded.
According to one or more embodiments of the present disclosure, in the loading device of the web page component:
the first loading unit is used for: if the loading mark corresponding to the version number to be loaded is loaded, omitting loading the component to be loaded;
the second loading unit is used for: if the loading mark corresponding to the version number to be loaded is not loaded, loading the component to be loaded according to the dependency information and the version number to be loaded, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code download address corresponding to the version number to be loaded, and modifying the loading marks corresponding to the version number to be loaded into loaded;
if the directly dependent component is not null, loading the code according to the code download address corresponding to the version number to be loaded, and taking the directly dependent component corresponding to the version number as the component to be loaded, acquiring the dependency information through the dependency information acquiring unit 510, acquiring the version number to be loaded through the version number acquiring unit 520, and loading through the first loading unit 530 and the second loading unit 540, until the loading marks corresponding to the version number to be loaded of all directly dependent components are loaded, and modifying the loading marks corresponding to the version to be loaded of the component to be loaded into loaded.
The foregoing description is only of the preferred embodiments of the disclosed embodiments and is presented for purposes of illustration of the principles of the technology being utilized. It will be appreciated by those skilled in the art that the scope of the disclosure in the embodiments of the disclosure is not limited to the specific combination of the above technical features, but also encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the disclosure. Such as the technical solution formed by mutually replacing the above-mentioned features and the technical features with similar functions (but not limited to) disclosed in the embodiments of the present disclosure.

Claims (10)

1. A method for loading a web page component, comprising:
obtaining dependency information of a component to be loaded, wherein the dependency information comprises a loading mark for identifying whether the component has been loaded, a code download address and a directly dependent component; the component to be loaded is the topmost component in the component dependency relationship;
if the loading mark is loaded, omitting loading the component to be loaded;
if the loading mark is not loaded, loading the component to be loaded according to the dependency information, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading addresses, and modifying the loading marks into loaded;
If the directly dependent component is not empty, loading codes according to the code downloading address, and respectively returning the directly dependent component as a component to be loaded to execute the step of acquiring the dependent information and the step of loading the component according to the dependent information until the loading marks of all directly dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded.
2. The method of claim 1, further comprising traversing dependency information of components to be loaded related to the web page before the web page is online, and uniformly setting loading marks in the dependency information to be unloaded, respectively.
3. The method of claim 1, further comprising determining the component to be loaded prior to obtaining dependency information for the component to be loaded, comprising:
acquiring an association component set related to the webpage;
and acquiring at least one association component of the direct dependent components which do not belong to any association component in the association component set, and determining the at least one association component as the component to be loaded.
4. The method of claim 3, wherein obtaining at least one of the association components of the set of association components that is not a direct-dependent component of any association component comprises:
Traversing the dependency information of the association component set, and deleting the directly dependent component from the association component set if the directly dependent component in the dependency information belongs to the association component set;
and taking the rest association components in the association component set as the at least one association component until the traversal is finished.
5. The method of claim 1, further comprising, after ending the loading:
if the code of any component is updated, replacing the code corresponding to the code download address in the dependency information of the component with a new code, and replacing the code of the component in the packaged file obtained after the loading is finished with the new code;
if the download address of any component is updated, the code download address in the dependency information of the component is replaced with a new code download address.
6. The method according to claim 1, characterized in that:
the loading marks in the dependency information of the component comprise loading marks corresponding to at least one version number;
the code download address in the dependency information of the component comprises at least one code download address corresponding to the version number;
the directly dependent components in the dependency information of the components comprise directly dependent components corresponding to at least one version number and version numbers of the dependent components;
Before loading the component to be loaded according to the dependency information of the component to be loaded, acquiring a version number to be loaded of the component to be loaded;
loading the component to be loaded according to the dependency information of the component to be loaded comprises the following steps: and loading the component to be loaded according to the dependency information of the component to be loaded and the version number to be loaded.
7. The method of claim 6, wherein loading the component to be loaded according to the dependency information of the component to be loaded and the version number to be loaded comprises;
if the loading mark corresponding to the version number to be loaded is loaded, omitting loading the component to be loaded;
if the loading mark corresponding to the version number to be loaded is not loaded, loading the component to be loaded according to the dependency information and the version number to be loaded, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code download address corresponding to the version number to be loaded, and modifying the loading marks corresponding to the version number to be loaded into loaded;
and if the directly dependent component is not empty, loading codes according to the code download address corresponding to the version number to be loaded, and respectively returning the directly dependent component corresponding to the version number as the component to be loaded to execute the step of acquiring the dependency information, the step of acquiring the version number to be loaded and the step of loading the component according to the dependency information and the version number to be loaded until the loading marks corresponding to the version numbers to be loaded of all directly dependent components are loaded, and modifying the loading marks corresponding to the version to be loaded of the component to be loaded into loaded.
8. A loading device for a web page component, comprising:
a dependency information acquisition unit configured to acquire dependency information of a component to be loaded, wherein the dependency information includes a load flag for identifying whether or not the component has been loaded, a code download address, and a component directly dependent; the component to be loaded is the topmost component in the component dependency relationship;
the first loading unit is used for omitting loading the component to be loaded if the loading mark is loaded;
the second loading unit is configured to load the component to be loaded according to the dependency information if the loading flag is unloaded, and includes:
if the directly dependent component is empty or the loading marks of the directly dependent component are loaded, loading codes according to the code downloading addresses, and modifying the loading marks into loaded;
if the directly dependent component is not empty, loading codes according to the code downloading address, respectively taking the directly dependent component as a component to be loaded, acquiring the dependent information through the dependent information acquisition unit, and loading through the first loading unit and the second loading unit until the loading marks of all directly dependent components are loaded, and modifying the loading marks of the component to be loaded into loaded.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs;
the instructions that when executed by the one or more processors cause the one or more processors to implement the method of any of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-7.
CN201911134881.5A 2019-11-19 2019-11-19 Webpage component loading method and device, electronic equipment and storage medium Active CN110865852B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911134881.5A CN110865852B (en) 2019-11-19 2019-11-19 Webpage component loading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911134881.5A CN110865852B (en) 2019-11-19 2019-11-19 Webpage component loading method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110865852A CN110865852A (en) 2020-03-06
CN110865852B true CN110865852B (en) 2023-06-30

Family

ID=69655025

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911134881.5A Active CN110865852B (en) 2019-11-19 2019-11-19 Webpage component loading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110865852B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111581563B (en) * 2020-04-30 2023-04-28 北京字节跳动网络技术有限公司 Page response method and device, storage medium and electronic equipment
CN114637548A (en) * 2022-02-18 2022-06-17 高德信息技术有限公司 Dependency module loading method and device and computer program product
CN114546534B (en) * 2022-02-28 2023-11-24 百果园技术(新加坡)有限公司 Application page starting method, device, equipment and medium
CN117668327A (en) * 2024-02-02 2024-03-08 深圳开源互联网安全技术有限公司 Component identification method, device, terminal equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6748591B1 (en) * 2000-09-14 2004-06-08 International Business Machines Corporation Method, system, program, and data structures for loading programs into a runtime environment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103812905B (en) * 2012-11-14 2017-10-24 中兴通讯股份有限公司 A kind of internet-of-things terminal application continuum generates system and method
CN104424239B (en) * 2013-08-27 2017-12-19 北大方正集团有限公司 resource file loading method and device
CN105701113B (en) * 2014-11-27 2019-04-09 国际商业机器公司 Method and apparatus for optimizing webpage preloading
US9552169B2 (en) * 2015-05-07 2017-01-24 Intel Corporation Apparatus and method for efficient memory renaming prediction using virtual registers
CN106990976A (en) * 2016-01-21 2017-07-28 阿里巴巴集团控股有限公司 A kind of page script loading method and device
CN106815031B (en) * 2017-02-22 2020-03-24 百度在线网络技术(北京)有限公司 Kernel module loading method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6748591B1 (en) * 2000-09-14 2004-06-08 International Business Machines Corporation Method, system, program, and data structures for loading programs into a runtime environment

Also Published As

Publication number Publication date
CN110865852A (en) 2020-03-06

Similar Documents

Publication Publication Date Title
CN110865852B (en) Webpage component loading method and device, electronic equipment and storage medium
CN110471709B (en) Method, device, medium and electronic equipment for accelerating webpage opening speed
CN112214408B (en) Dependency conflict detection method, dependency conflict detection device, electronic equipment and computer readable medium
CN111274503B (en) Data processing method, device, electronic equipment and computer readable medium
CN111240767A (en) Component and page loading method and device, electronic equipment and storage medium
CN110673986A (en) Memory operation abnormity capturing method, device, terminal and storage medium
CN111625422B (en) Thread monitoring method, thread monitoring device, electronic equipment and computer readable storage medium
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN111324258B (en) Method, device, equipment and medium for generating contents of configuration items of multilevel pull-down menu
CN111460432B (en) On-line document authority control method, device, equipment and computer readable medium
CN111177634A (en) Multi-language supporting file content loading method, device, equipment and medium
CN111596992A (en) Navigation bar display method and device and electronic equipment
CN111309406A (en) Event processing method and device of application program and electronic equipment
CN116244004A (en) Resource management method, device, medium and electronic equipment
CN114741686A (en) Method and device for detecting program white list and related equipment
CN110618772B (en) View adding method, device, equipment and storage medium
CN111210271B (en) Method, device, electronic equipment and storage medium for identifying form cheating
CN111240657A (en) Method and device for generating SDK and electronic equipment
CN111209739A (en) Electronic form, electronic device, storage medium, and electronic form verification method
CN111562913B (en) Method, device and equipment for pre-creating view component and computer readable medium
CN113448550B (en) Method and device for realizing collection management of classes, electronic equipment and computer medium
CN111626787B (en) Resource issuing method, device, medium and equipment
CN111367555B (en) Assertion method, assertion device, electronic equipment and computer readable medium
CN116701013A (en) Message consumption method, device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant