CN110865852A - 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
CN110865852A
CN110865852A CN201911134881.5A CN201911134881A CN110865852A CN 110865852 A CN110865852 A CN 110865852A CN 201911134881 A CN201911134881 A CN 201911134881A CN 110865852 A CN110865852 A CN 110865852A
Authority
CN
China
Prior art keywords
component
loaded
loading
dependency information
code
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.)
Granted
Application number
CN201911134881.5A
Other languages
Chinese (zh)
Other versions
CN110865852B (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 method and a device for loading a webpage component, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring the 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, the loading is omitted; if the loading mark is not loaded and the directly dependent component is empty or the loading marks of the directly dependent components are all loaded, loading the code according to the code downloading address and modifying the loading mark into the loaded state; and if the loading mark is not loaded and the directly dependent components are not empty, loading the codes according to the code downloading addresses, and respectively taking the directly dependent components as the components to be loaded and returning to execute the steps until the loading marks of all the directly dependent components are loaded and the loading marks of the components to be loaded are changed into loaded. The data packet is prevented from being overstaffed due to repeated code loading, and the loading speed can be increased.

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 method and a device for loading a webpage component, electronic equipment and a storage medium.
Background
When front-end development is carried out, a modular development mode is generally adopted, and components often have complex dependency relationship. Many components may be reloaded and compiled in one application because they are repeatedly relied upon. For example, if an application or component needs to load component C and component D, and the components that they depend on may be crossed, for example, component C and component D both depend on component a and component B, then loading component C and component D may load component a and component B, resulting in repeated loading of components, which may not only make the data packet bulky, but also reduce the loading speed.
Disclosure of Invention
In view of this, embodiments of the present disclosure provide a method and an apparatus for loading a web page component, an electronic device, and a storage medium, so as to avoid a data packet being bloated due to repeated code loading.
Additional features and advantages of the disclosed embodiments will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosed embodiments.
In a first aspect, an embodiment of the present disclosure provides a method for loading a web page component, including:
acquiring dependency information of a component to be loaded, wherein the dependency information comprises a loading mark for identifying whether the component is loaded, a code downloading address and a directly dependent component;
if the loading mark is loaded, the component to be loaded is omitted from loading;
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 all loaded, loading the code according to the code downloading address and modifying the loading marks into the loaded state;
and if the directly dependent component is not empty, loading a code according to the code download address, and respectively taking the directly dependent component as a component to be loaded, returning to execute the step of acquiring the dependency information and the step of loading the component according to the dependency information until the loading marks of all the directly dependent components are loaded, and modifying the loading marks of the component to be loaded into the loaded state.
In a second aspect, an embodiment of the present disclosure further provides a device for loading a web page component, including:
the device comprises a dependence information acquisition unit, a processing unit and a control unit, wherein the dependence information acquisition unit is used for acquiring dependence information of a component to be loaded, and the dependence information comprises a loading mark used for identifying whether the component is loaded, a code downloading address and a directly dependent component;
the first loading unit is used for omitting the loading of the component to be loaded if the loading mark is loaded;
a second loading unit, configured to load the component to be loaded according to the dependency information if the loading flag is not loaded, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are all loaded, loading the code according to the code downloading address and modifying the loading marks into the loaded state;
and if the directly dependent component is not empty, loading a code according to the code download address, and respectively taking the directly dependent component as a component to be loaded, acquiring the dependency information through the dependency information acquisition unit and loading through the first loading unit and the second loading unit until the loading marks of all the directly dependent components are loaded, and modifying the loading marks of the component to be loaded into the loaded state.
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;
when executed by the one or more processors, cause the one or more processors to implement the instructions of the method of any one of the first aspects.
In a fourth aspect, the disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method according to any one of the first aspect.
The technical scheme provided by the embodiment of the disclosure has the beneficial technical effects that:
according to the method and the device for loading the components to be loaded, dependency information (including loading marks, code downloading addresses and directly dependent components) of the components is recorded, the components to be loaded are loaded according to the dependency information of the components to be loaded, the phenomenon that data packets are bloated due to the fact that codes are loaded repeatedly can be avoided, and the loading speed can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments of the present disclosure will be briefly described below, and it is obvious that the drawings in the following description are only a part of the embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to the contents of the embodiments of the present disclosure and the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for loading a web page component according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of another loading method for web page components according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a loading apparatus for a web page component according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of another loading apparatus for web page components according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a loading apparatus 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, technical solutions adopted and technical effects achieved by the embodiments of the present disclosure clearer, 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 obvious that the described embodiments are only some embodiments, but not all embodiments, of the embodiments of the present disclosure. All other embodiments, which can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present disclosure, belong to the protection scope of the embodiments of the present disclosure.
It should be noted that the terms "system" and "network" are often used interchangeably in the embodiments of the present disclosure. Reference to "and/or" in embodiments of the present disclosure is meant to include any and all combinations of one or more of the associated listed items. The terms "first", "second", and the like in the description and claims of the present disclosure and in the drawings are used for distinguishing between different objects and not for limiting a particular order.
It should also be noted that, in the embodiments of the present disclosure, each of the following embodiments may be executed alone, or may be executed in combination with each other, and the embodiments of the present disclosure are not limited specifically.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The technical solutions of the embodiments of the present disclosure are further described by the following detailed description in conjunction with the accompanying drawings.
Fig. 1 shows a flowchart of a method for loading a web page component according to an embodiment of the present disclosure, where the embodiment is applicable to a case of loading a web page component, and the method may be executed by a loading device of a web page component configured in an electronic device, as shown in fig. 1, the method for loading a web page component according to the embodiment includes:
in step S110, dependency information of the component to be loaded is acquired.
Wherein the dependency information includes at least a load flag for identifying whether or not it has been loaded, a code download address, and a directly dependent component.
The specific record form of the dependency information of the components is not limited in this embodiment, for example, each component may use a JSON key VALUE pair to store the dependency information thereof, the key is a component name or a component identifier, and the VALUE includes: a load tag, a code download address URL, a directly dependent component name or component identification, etc.
In step S120, it is determined whether the loading flag is loaded, if so, the process is terminated, otherwise, step S130 is executed.
If the loading mark of the component to be loaded is loaded, the component to be loaded is indicated to be loaded, so that the component to be loaded is omitted from being loaded, and repeated loading is avoided.
In step S130, it is determined whether the directly dependent component is empty or the loading flags are all 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 respectively used as the components to be loaded.
Before the webpage is on-line, the loading marks in the dependency information of the related components are not loaded, the dependency information of the components to be loaded related to the webpage can be traversed, and the loading marks in the dependency information are uniformly set to be not loaded. In order to omit the step of determining the relevant components to be loaded, the load in the dependency information of all components should be marked as 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 dependency relationship of the components is mainly determined as the component to be loaded, and the dependent components are loaded layer by layer.
The component to be loaded may be given or obtained by calculation, for example, by the following method:
acquiring an associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, and determining the at least one association component as the component to be loaded. For example, traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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.
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 packed file obtained after loading is finished with the new code; and if the download address of any component is updated, replacing the code download address in the dependency information of the component with the new code download address.
According to the method and the device for loading the components to be loaded, dependency information (including loading marks, code downloading addresses and directly dependent components) of the components is recorded, the components to be loaded are loaded according to the dependency information of the components to be loaded, the phenomenon that data packages are bloated due to the fact that codes are loaded repeatedly can be avoided, and the loading speed can be increased.
Fig. 2 is a schematic flow chart illustrating another method for loading a web page component according to an embodiment of the present disclosure, and the embodiment is based on the foregoing embodiment and is optimized. As shown in fig. 2, the method for loading a web page component according to this embodiment includes:
in step S210, dependency information of the 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. determining which version of said component to be loaded needs to be loaded.
In step S230, it is determined whether the directly dependent component is empty or the loading flags are all 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 yes, step S250 is executed, otherwise step S260 is executed.
In step S250, a code is loaded according to the code download address corresponding to the version number to be loaded, and the load flag corresponding to the version number to be loaded is modified to be loaded.
In step S260, a 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 brought online, dependency information of components to be loaded related to the web page can be traversed, and loading marks in the dependency information are uniformly set to be unloaded.
Further, before obtaining the dependency information of the component to be loaded, the component to be loaded may also be determined by:
acquiring an associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, and determining the at least one association component as the component to be loaded. For example, traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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, after the 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 packed file obtained after the loading is finished with the new code; and if the download address of any component is updated, replacing the code download address in the dependency information of the component with the new code download address.
On the basis of the previous embodiment, the embodiment realizes a method for loading the webpage components under the condition that each component has at least one version and the dependency information includes a dependent component and a dependent version, loads the components to be loaded according to the dependency information and the version number of the components to be loaded by recording the dependency information (including a loading mark, a code downloading address and a directly dependent component) of each component, and can avoid the data packet from being bloated due to repeated code loading and improve the loading speed.
As an implementation of the methods shown in the above figures, the present application provides an embodiment of a loading apparatus for a web page component, and fig. 3 illustrates a schematic structural diagram of a loading apparatus for a web page component provided in this embodiment, where the embodiment of the apparatus corresponds to the embodiment of the methods shown in fig. 1 and fig. 2, and the apparatus may be specifically applied to various electronic devices. As shown in fig. 3, the loading apparatus of the web page component according to the 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, where 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 loading flag is loaded.
The second loading unit 330 is configured to, if the loading flag is not loaded, load 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 all loaded, loading the code according to the code downloading address and modifying the loading marks into the loaded state;
if the directly dependent component is not empty, loading a code according to the code download address, and taking the directly dependent component as a component to be loaded, acquiring the dependency information through the dependency information acquisition unit and loading through the first loading unit 320 and the second loading unit 330, 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.
Further, the apparatus further includes an online preprocessing unit (not shown in fig. 3), configured to traverse dependency information of components to be loaded related to the web page before the web page is online, and uniformly set a loading flag in the dependency information to be unloaded.
The loading device for the webpage component provided by the embodiment can execute the loading method for the webpage component provided by the embodiment of the method disclosed by the invention, and has corresponding functional modules and beneficial effects of the execution method.
As an implementation of the methods shown in the above figures, the present application provides an embodiment of another loading apparatus for a web page component, and fig. 4 illustrates a schematic structural diagram of the loading apparatus for a web page component provided in this embodiment, where the embodiment of the apparatus corresponds to the embodiment of the methods shown in fig. 1 and fig. 2, and the apparatus may be specifically applied to various electronic devices. As shown in fig. 4, the loading apparatus of a web page component according to this embodiment includes a to-be-loaded component 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 to-be-loaded component determining unit 410 is configured to determine the to-be-loaded component, and includes:
acquiring an associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, 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, where 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 loading flag is loaded.
The second loading unit 440 is configured to, if the loading flag is not loaded, load 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 all loaded, loading the code according to the code downloading address and modifying the loading marks into the loaded state;
if the directly dependent component is not empty, loading a code according to the code download address, and taking the directly dependent component as a component to be loaded, acquiring the dependency information through the dependency information acquisition unit 420 and loading through the first loading unit 430 and the second loading unit 440, 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 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 packed file obtained after loading is finished with the new code;
and if the download address of any component is updated, replacing the code download address in the dependency information of the component with the new code download address.
Further, the to-be-loaded component determining unit 410 is configured to:
traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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 for the webpage component provided by the embodiment can execute the loading method for the webpage component provided by the embodiment of the method disclosed by the invention, and has corresponding functional modules and beneficial effects of the execution method.
As an implementation of the methods shown in the above figures, the present application provides an embodiment of a further apparatus for loading a web page component, and fig. 5 illustrates a schematic structural diagram of another apparatus for loading a web page component provided in an embodiment of the present disclosure, and as shown in fig. 5, the apparatus for loading a web page component described in this 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, where the dependency information includes a load flag for identifying whether the component has been loaded, a code download address, and a directly dependent component.
And the loading mark comprises at least one loading mark corresponding to the version number.
The code download address comprises at least one code download address corresponding to the version number.
The directly dependent components comprise at least one directly dependent component corresponding to the version number and the version number of the dependent component.
The version number obtaining unit 520 is configured to obtain the 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, if the loading flag corresponding to the version number to be loaded is not loaded, load 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 downloading address corresponding to the version number to be loaded, and modifying the loading mark corresponding to the version number to be loaded into the loaded state;
if the directly dependent component is not empty, loading a code according to a code download address corresponding to the version number to be loaded, and respectively taking the directly dependent component corresponding to the version number as the component to be loaded, acquiring dependency information through the dependency information acquisition unit 510, acquiring the version number to be loaded through the version number acquisition unit 520, and loading through the first loading unit 530 and the second loading unit 540 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 versions to be loaded of the component to be loaded into loaded.
Further, the apparatus further includes an online preprocessing unit (not shown in fig. 5), configured to traverse dependency information of components to be loaded related to the web page before the web page is online, and uniformly set a loading flag in the dependency information to be unloaded.
Further, the apparatus further includes a to-be-loaded component determining unit (not shown in fig. 5), configured to determine the to-be-loaded component before obtaining the dependency information of the to-be-loaded component, where the determining unit includes:
acquiring an associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, and determining the at least one association component as the component to be loaded.
Further, the to-be-loaded component determination unit is configured to:
traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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:
and 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 packed file obtained after loading is finished with the new code.
And if the download address of any component is updated, replacing the code download address in the dependency information of the component with the new code download address.
The loading device for the webpage component provided by the embodiment can execute the loading method for the webpage component provided by the embodiment of the method disclosed by the invention, and has corresponding functional modules and beneficial effects of the execution method.
Referring now to FIG. 6, a block diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with 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 necessary 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 via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, 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 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the 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 illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
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. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled 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:
acquiring dependency information of a component to be loaded, wherein the dependency information comprises a loading mark for identifying whether the component is loaded, a code downloading 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, the directly dependent component is empty or the loading marks of the directly dependent components are all loaded, loading the code according to the code downloading address, modifying the loading mark into the loaded state, and ending;
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 taking the directly dependent component as the component to be loaded, returning to execute the step of acquiring the dependency information and the step of loading the component according to the dependency information until the loading marks of all the directly dependent components are loaded, modifying the loading mark of the component to be loaded into the loaded state, and ending.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart 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 described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
According to one or more embodiments of the present disclosure, the method for loading a web page component further includes, before the web page is brought online, traversing dependency information of a component to be loaded related to the web page, and uniformly setting a loading flag in the dependency information to be unloaded.
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 associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, 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 method of the web page component, acquiring at least one associated component of the directly dependent components in the associated component set, which do not belong to any associated component, includes:
traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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 the 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 packed file obtained after loading is finished with the new code;
and if the download address of any component is updated, replacing the code download address in the dependency information of the component with the 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 components 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 at least one directly dependent component corresponding to the version number and the version number of the dependent component;
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: and loading the component to be loaded according to the dependency information and the version number to be loaded of the component to be loaded.
According to one or more embodiments of the disclosure, in the loading method of the webpage 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 comprises;
if the loading mark corresponding to the version number to be loaded is loaded, the component to be loaded is omitted;
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 downloading address corresponding to the version number to be loaded, and modifying the loading mark corresponding to the version number to be loaded into the loaded state;
and if the directly dependent component is not empty, loading codes according to a code download address corresponding to the version number to be loaded, and respectively taking the directly dependent component with the corresponding version number as the component to be loaded, returning 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 the directly dependent components are loaded, and modifying the loading marks corresponding to the version numbers 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 dependency information of the component to be loaded related to the web page before the web page is online, and uniformly set a loading flag in the dependency information to be unloaded.
According to one or more embodiments of the present disclosure, the loading apparatus of the web page component further includes a to-be-loaded component determining unit, configured to determine the to-be-loaded component before obtaining the dependency information of the to-be-loaded component, including:
acquiring an associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, 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 apparatus of the web page component, the to-be-loaded component determining unit is configured to:
traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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 packed file obtained after loading is finished with the new code;
and if the download address of any component is updated, replacing the code download address in the dependency information of the component with the 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 components 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 at least one directly dependent component corresponding to the version number and the version number of the dependent component;
the device also comprises a version number obtaining unit, which is used for obtaining the 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 loading unit is used for: and loading the component to be loaded according to the dependency information and the version number to be loaded of 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 first loading unit is used for: if the loading mark corresponding to the version number to be loaded is loaded, the component to be loaded is omitted;
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 downloading address corresponding to the version number to be loaded, and modifying the loading mark corresponding to the version number to be loaded into the loaded state;
if the directly dependent component is not empty, loading a code according to a code download address corresponding to the version number to be loaded, and respectively taking the directly dependent component corresponding to the version number as the component to be loaded, acquiring dependency information through the dependency information acquisition unit 510, acquiring the version number to be loaded through the version number acquisition unit 520, and loading through the first loading unit 530 and the second loading unit 540 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 versions to be loaded of the component to be loaded into loaded.
The foregoing description is only a preferred embodiment of the disclosed embodiments and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure in the embodiments of the present disclosure is not limited to the particular combination of the above-described features, but also encompasses other embodiments in which any combination of the above-described features or their equivalents is possible without departing from the scope of the present disclosure. For example, the above features and (but not limited to) the features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (10)

1. A method for loading a webpage component is characterized by comprising the following steps:
acquiring dependency information of a component to be loaded, wherein the dependency information comprises a loading mark for identifying whether the component is loaded, a code downloading address and a directly dependent component;
if the loading mark is loaded, the component to be loaded is omitted from loading;
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 all loaded, loading the code according to the code downloading address and modifying the loading marks into the loaded state;
and if the directly dependent component is not empty, loading a code according to the code download address, and respectively taking the directly dependent component as a component to be loaded, returning to execute the step of acquiring the dependency information and the step of loading the component according to the dependency information until the loading marks of all the directly dependent components are loaded, and modifying the loading marks of the component to be loaded into the loaded state.
2. The method according to claim 1, further comprising, before the web page is brought online, traversing the dependency information of the components to be loaded related to the web page, and uniformly setting the loading flag in the dependency information to be unloaded.
3. The method of claim 1, further comprising determining the component to be loaded before obtaining the dependency information of the component to be loaded, comprising:
acquiring an associated component set related to the webpage;
and acquiring at least one association component of the direct dependent components in the association component set, which do not belong to any association component, 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 associated component of the set of associated components that is not a direct dependent component of any associated component comprises:
traversing the dependency information of the association component set, and if the directly dependent component in the dependency information belongs to the association component set, deleting the directly dependent component from 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 packed file obtained after loading is finished with the new code;
and if the download address of any component is updated, replacing the code download address in the dependency information of the component with the new code download address.
6. The method of claim 1, wherein:
the loading marks in the dependency information of the components 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 at least one directly dependent component corresponding to the version number and the version number of the dependent component;
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: and loading the component to be loaded according to the dependency information and the version number to be loaded of the component to be loaded.
7. The method according to claim 6, wherein loading the component to be loaded according to the dependency information and the version number to be loaded comprises;
if the loading mark corresponding to the version number to be loaded is loaded, the component to be loaded is omitted;
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 downloading address corresponding to the version number to be loaded, and modifying the loading mark corresponding to the version number to be loaded into the loaded state;
and if the directly dependent component is not empty, loading codes according to a code download address corresponding to the version number to be loaded, and respectively taking the directly dependent component with the corresponding version number as the component to be loaded, returning 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 the directly dependent components are loaded, and modifying the loading marks corresponding to the version numbers to be loaded of the component to be loaded into loaded.
8. An apparatus for loading a web page component, comprising:
the device comprises a dependence information acquisition unit, a processing unit and a control unit, wherein the dependence information acquisition unit is used for acquiring dependence information of a component to be loaded, and the dependence information comprises a loading mark used for identifying whether the component is loaded, a code downloading address and a directly dependent component;
the first loading unit is used for omitting the loading of the component to be loaded if the loading mark is loaded;
a second loading unit, configured to load the component to be loaded according to the dependency information if the loading flag is not loaded, including:
if the directly dependent component is empty or the loading marks of the directly dependent component are all loaded, loading the code according to the code downloading address and modifying the loading marks into the loaded state;
and if the directly dependent component is not empty, loading a code according to the code download address, and respectively taking the directly dependent component as a component to be loaded, acquiring the dependency information through the dependency information acquisition unit and loading through the first loading unit and the second loading unit until the loading marks of all the directly dependent components are loaded, and modifying the loading marks of the component to be loaded into the loaded state.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs;
instructions which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 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 true CN110865852A (en) 2020-03-06
CN110865852B 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)

Cited By (4)

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

Citations (8)

* 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
CN101963987A (en) * 2010-09-30 2011-02-02 百度在线网络技术(北京)有限公司 Methods and equipments for generating and loading web page file
WO2014075471A1 (en) * 2012-11-14 2014-05-22 中兴通讯股份有限公司 Integrated application generating system and method for internet of things terminal
CN104424239A (en) * 2013-08-27 2015-03-18 北大方正集团有限公司 Resource file loading method and device
US20160156732A1 (en) * 2014-11-27 2016-06-02 International Business Machines Corporation Web Page Pre-loading Optimization
US20160328172A1 (en) * 2015-05-07 2016-11-10 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
US20190213014A1 (en) * 2017-02-22 2019-07-11 Baidu Online Network Technology (Beijing) Co., Ltd Method and apparatus for loading kernel module

Patent Citations (8)

* 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
CN101963987A (en) * 2010-09-30 2011-02-02 百度在线网络技术(北京)有限公司 Methods and equipments for generating and loading web page file
WO2014075471A1 (en) * 2012-11-14 2014-05-22 中兴通讯股份有限公司 Integrated application generating system and method for internet of things terminal
CN104424239A (en) * 2013-08-27 2015-03-18 北大方正集团有限公司 Resource file loading method and device
US20160156732A1 (en) * 2014-11-27 2016-06-02 International Business Machines Corporation Web Page Pre-loading Optimization
US20160328172A1 (en) * 2015-05-07 2016-11-10 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
US20190213014A1 (en) * 2017-02-22 2019-07-11 Baidu Online Network Technology (Beijing) Co., Ltd Method and apparatus for loading kernel module

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111581563A (en) * 2020-04-30 2020-08-25 北京字节跳动网络技术有限公司 Page response method and device, storage medium and electronic equipment
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
CN114546534A (en) * 2022-02-28 2022-05-27 百果园技术(新加坡)有限公司 Application page starting method, device, equipment and medium
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

Also Published As

Publication number Publication date
CN110865852B (en) 2023-06-30

Similar Documents

Publication Publication Date Title
CN110865852B (en) Webpage component loading method and device, electronic equipment and storage medium
CN111581563A (en) Page response method and device, storage medium and electronic equipment
CN110471709B (en) Method, device, medium and electronic equipment for accelerating webpage opening speed
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
CN110704833A (en) Data permission configuration method, device, electronic device and storage medium
CN110673986A (en) Memory operation abnormity capturing method, device, terminal and storage medium
CN111273985A (en) Page rendering method and 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
CN111460432B (en) On-line document authority control method, device, equipment and computer readable medium
CN111324258B (en) Method, device, equipment and medium for generating contents of configuration items of multilevel pull-down menu
CN110147283B (en) Display content switching display method, device, equipment and medium
CN111177634A (en) Multi-language supporting file content loading method, device, equipment and medium
CN111756953A (en) Video processing method, device, equipment and computer readable medium
CN111309406A (en) Event processing method and device of application program and electronic equipment
WO2023056841A1 (en) Data service method and apparatus, and related product
CN116010743A (en) Page processing method and device, electronic equipment and storage medium
CN114741686A (en) Method and device for detecting program white list and related equipment
CN110618772B (en) View adding method, device, equipment and storage medium
CN111240657A (en) Method and device for generating SDK and electronic equipment
CN111538577A (en) Program execution control device and method, terminal and storage medium
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
CN111210271B (en) Method, device, electronic equipment and storage medium for identifying form cheating

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