CN110858240A - Front-end module loading method and device - Google Patents

Front-end module loading method and device Download PDF

Info

Publication number
CN110858240A
CN110858240A CN201810923025.7A CN201810923025A CN110858240A CN 110858240 A CN110858240 A CN 110858240A CN 201810923025 A CN201810923025 A CN 201810923025A CN 110858240 A CN110858240 A CN 110858240A
Authority
CN
China
Prior art keywords
module
loaded
dependent
resources
determining
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.)
Pending
Application number
CN201810923025.7A
Other languages
Chinese (zh)
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 Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810923025.7A priority Critical patent/CN110858240A/en
Publication of CN110858240A publication Critical patent/CN110858240A/en
Pending legal-status Critical Current

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

Abstract

The invention discloses a front-end module loading method and device, and relates to the technical field of computers. One embodiment of the method comprises: acquiring module identification and configuration attribute information of a module to be loaded; determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information; and loading module resources and dependent resources of the module to be loaded. The implementation method analyzes the dependent resources by using the configuration attribute information of the module, thereby automatically loading the required resources, achieving the purposes of reducing the maintenance cost and modularly developing the interface, and having low network overhead and high efficiency.

Description

Front-end module loading method and device
Technical Field
The invention relates to the technical field of computers, in particular to a front-end module loading method and device.
Background
At present, when an interface development project develops a page, JS (Javascript, a scripting language, which is mainly used for scripting programming of special effects and functions of the page) resources and CSS (Cascading style sheets, which is a markup language for controlling a page style and allowing style information to be separated from page content) resources are often introduced in the following ways:
the first method is as follows: in the page, introducing the required resources in a tag form;
the second method comprises the following steps: putting all used resources in a page template, wherein the page needs to be introduced into the template;
the third method comprises the following steps: the required modular script is introduced by using a module engine framework such as Sea (a TCP protocol framework) or Requirejs (a JavaScript module loading framework).
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
aiming at the first mode: after the current version is iterated for a period of time, later-period maintenance personnel have to be large in size to introduce resources and also have to be familiar with the function range influenced by each introduced resource, so that the maintenance cost is high and the efficiency is low;
in the second embodiment: most pages introduce some resources irrelevant to the current interface, and the network overhead is increased;
the third method is as follows: there is a need to manually introduce dependent CSS resources on a page while developing individual modules. When the module is not used any more, the CSS resource file needs to be deleted manually, and maintenance cost is increased.
Disclosure of Invention
In view of this, embodiments of the present invention provide a front-end module loading method and apparatus, where configuration attribute information of a module is used to analyze its dependent resources, so as to automatically load required resources, achieve the purposes of reducing maintenance cost and modular interface development, and have low network overhead and high efficiency.
According to an aspect of an embodiment of the present invention, a front-end module loading method is provided.
The front-end module loading method provided by the embodiment of the invention comprises the following steps:
acquiring module identification and configuration attribute information of a module to be loaded;
determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information;
loading module resources and dependent resources of a module to be loaded;
wherein, the module resource means: script resources, or script resources and cascading style sheet resources; the dependent resources of the module to be loaded refer to the dependent module of the module to be loaded and the extension module dependent on the module to be loaded.
Optionally, the configuration attribute information includes: the method comprises the steps of identifying a dependent module of a module to be loaded and an extended module of the module to be loaded;
determining the dependent resources of the module to be loaded according to the configuration attribute information, wherein the determining comprises the following steps: and determining the dependent module of the module to be loaded according to the dependent module identifier of the module to be loaded, and determining the expansion module of the module to be loaded according to the expansion module identifier of the module to be loaded.
Optionally, loading the dependent resource of the module to be loaded according to the following steps:
firstly, acquiring a dependent module of a module to be loaded, and acquiring an extension module of the module to be loaded after all dependent modules of the module to be loaded are acquired; sequentially taking the acquired dependency module and the expansion module as an element, and determining whether the element exists in a dependency resource set; if the element exists, the element in the dependent resource set is moved to the first position of the dependent resource set, otherwise, the element is placed into the first position of the dependent resource set; wherein initially the dependent resource set is an empty set.
Optionally, after loading the module resource and the dependent resource of the module to be loaded, the method further includes: and merging and compressing module resources and dependent resources of the module to be loaded.
According to an aspect of an embodiment of the present invention, there is provided a front-end module loading apparatus.
The front-end module loading device according to the embodiment of the invention comprises:
the module management unit is used for acquiring the module identification and the configuration attribute information of the module to be loaded; determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information;
the resource management unit loads module resources and dependent resources of the module to be loaded;
wherein, the module resource means: script resources, or script resources and cascading style sheet resources; the dependent resources of the module to be loaded refer to the dependent module of the module to be loaded and the extension module dependent on the module to be loaded.
Optionally, the configuration attribute information includes: the method comprises the steps of identifying a dependent module of a module to be loaded and an extended module of the module to be loaded;
the module management unit determines the dependent resources of the module to be loaded according to the configuration attribute information, and the method comprises the following steps: and determining the dependent module of the module to be loaded according to the dependent module identifier of the module to be loaded, and determining the expansion module of the module to be loaded according to the expansion module identifier of the module to be loaded.
Optionally, the resource management unit loads the dependent resource of the module to be loaded according to the following steps:
firstly, acquiring a dependent module of a module to be loaded, and acquiring an extension module of the module to be loaded after all dependent modules of the module to be loaded are acquired; sequentially taking the acquired dependency module and the expansion module as an element, and determining whether the element exists in a dependency resource set; if the element exists, the element in the dependent resource set is moved to the first position of the dependent resource set, otherwise, the element is placed into the first position of the dependent resource set; wherein initially the dependent resource set is an empty set.
Optionally, the front-end module loading apparatus according to the embodiment of the present invention further includes: and the packing unit is used for merging and compressing the module resources and the dependent resources of the module to be loaded after the module resources and the dependent resources of the module to be loaded are loaded by the resource management unit.
According to another aspect of an embodiment of the present invention, there is provided a front-end module-loading electronic device.
The front-end module loading electronic device according to the embodiment of the invention comprises:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the front-end module loading method provided by the first aspect of the embodiments of the present invention.
According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.
According to the computer readable medium of the embodiment of the present invention, a computer program is stored thereon, and when the program is executed by a processor, the front-end module loading method provided by the first aspect of the embodiment of the present invention is implemented.
One embodiment of the above invention has the following advantages or benefits: the configuration attribute information of the module is used for analyzing the dependent resources, so that the required resources are automatically loaded, the aims of reducing the maintenance cost and developing the interface modularization are fulfilled, the network overhead is low, and the efficiency is high.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a front-end module loading method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of the main flow of a front end module loading method according to an alternative embodiment of the invention;
FIG. 3 is a schematic diagram of the main modules of a front end module loading apparatus according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
According to an aspect of an embodiment of the present invention, a front-end module loading method is provided.
Fig. 1 is a schematic diagram of a main flow of a front-end module loading method according to an embodiment of the present invention. As shown in fig. 1, the front-end module loading method includes: step S101, step S102, and step S103.
Step S101, obtaining module identification and configuration attribute information of a module to be loaded. The module identifier is used to uniquely identify a module. The configuration attribute information is information configured at the time of module registration.
And S102, determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information. Wherein, the module resource means: script resources, or script resources and cascading style sheet resources; the dependent resources of the module to be loaded refer to the dependent module of the module to be loaded and the extension module dependent on the module to be loaded.
The front-end module is often divided into three resources, namely a JS file of the module, a CSS file of the module and a CSS file of the module. JS is an abbreviation for Javascript, a scripting language. The JS file is mainly used for script programming of special effects and functions of the webpage. CSS is an abbreviation of capturing Style Sheet, i.e., a Cascading Style Sheet, which is a markup language for controlling web page styles and allowing Style information to be separated from web page contents. The CSS file may not only statically modify the web page, but may also dynamically format elements of the web page in coordination with various scripting languages. A module dependent resource sets the resource that depends on the module, and the resource that the module depends on. For example, if an interface of the module B is called in the loading process of the module a, the module a depends on the module B, the module a is an extension module of the module B, and the module B is a dependent module of the module a. If module A depends on module B, which needs to depend on modules C and D, then module B, C, D needs to be loaded at the same time module A is loaded.
And S103, loading module resources and dependent resources of the module to be loaded.
The configuration attribute information of the module is used for analyzing the dependent resources, so that the required resources are automatically loaded, and the aims of reducing the maintenance cost and modularly developing the interface are fulfilled. The embodiment of the invention only loads the required resources and does not introduce the resources irrelevant to the current interface, thereby having small network overhead. And each required resource can be automatically loaded, excessive participation of maintenance personnel is not needed, and the maintenance efficiency is high.
In some embodiments, the configuration attribute information includes: the method comprises the steps of identifying a dependent module of a module to be loaded and an extended module of the module to be loaded; determining the dependent resources of the module to be loaded according to the configuration attribute information, wherein the determining comprises the following steps: and determining the dependent module of the module to be loaded according to the dependent module identifier of the module to be loaded, and determining the expansion module of the module to be loaded according to the expansion module identifier of the module to be loaded. And the corresponding module is identified and determined by adopting the identifier, so that the efficiency is high and the operation is simple.
The dependency strength of the module to be loaded and the dependent module is larger than that between the module to be loaded and the extended module. Based on the method, the dependent resources of the module to be loaded can be loaded according to the following steps: firstly, acquiring a dependent module of a module to be loaded, and acquiring an extension module of the module to be loaded after all dependent modules of the module to be loaded are acquired; sequentially taking the acquired dependency module and the expansion module as an element, and determining whether the element exists in a dependency resource set; if the element exists, the element in the dependent resource set is moved to the first position of the dependent resource set, otherwise, the element is placed into the first position of the dependent resource set; wherein initially the dependent resource set is an empty set.
For example, initially, the dependent resource set is an empty set, and after the first dependent module C1 is obtained, the dependent module is placed in the dependent resource set to obtain a set { dependent module C1 }; after the second dependent module C2 is obtained, since the dependent module C2 does not exist in the dependent resource set { dependent module C1}, the dependent module C2 is placed at the head of the dependent resource set, and a set { dependent module C2, dependent module C1} is obtained; after the third dependency module C3 is obtained, since the dependency module C3 does not exist in the dependency resource set { dependency module C2, dependency module C1}, the dependency module C3 is placed at the head of the dependency resource set, and a set { dependency module C3, dependency module C2, dependency module C1} is obtained; assuming that the obtained fourth dependency module is C1, since the dependency module C1 exists in the dependent resource set { dependency module C3, dependency module C2, and dependency module C1}, the element dependency module C1 in the dependent resource set is placed at the head of the dependent resource set, so as to obtain a set { dependency module C1, dependency module C3, and dependency module C2 }; and the like until all the dependent resources are put into the dependent resource set.
The sequence of merging is determined according to the strength of the dependency relationship between the modules, so that subsequent loading is facilitated and the user experience is improved.
After loading the module resource and the dependent resource of the module to be loaded, the method may further include: and merging and compressing module resources and dependent resources of the module to be loaded. For example, multiple resource files of the same type (e.g., JS files) are merged into one file. Therefore, the network connection times can be reduced, and the network overhead is reduced.
Fig. 2 is a schematic diagram of the main flow of a front-end module loading method according to an alternative embodiment of the invention. The front end module loading method is exemplified below in conjunction with fig. 2.
In fig. 2, "page context" is responsible for storing the page address when the module is created, the configuration attribute information of the module, and the like; the 'module manager' is responsible for receiving module requests and determining resources required by the modules to be loaded. The resource manager is responsible for loading the specified resource from the server, and when the resource to be loaded is found to be loaded, the resource manager does not carry out secondary loading. The module packaging tool is responsible for merging and compressing all files required by the module according to the module dependency relationship strength. The specific process comprises the following steps:
1. when a front-end requests a module, the "module manager" is invoked. The module manager judges whether the module to be loaded is loaded, if so, the resource manager directly returns the loaded resource, and the process is finished; otherwise, the resource manager loads the script resource of the module to be loaded;
judging whether the resources of the cascading style sheet of the module to be loaded need to be loaded by the module manager, if so, loading the resources of the cascading style sheet by the resource manager, and if not, entering the next step;
a 'module manager' analyzes the dependent resources according to the configuration attribute information of the module, if so, the 'resource manager' loads the dependent resources, and then the process is ended; otherwise, directly ending the flow;
and 4, the module packaging tool is responsible for merging and compressing all files required by the module according to the module dependency relationship strength and then returning the merged and compressed files to the front end.
According to an aspect of an embodiment of the present invention, there is provided a front-end module loading apparatus.
Fig. 3 is a schematic diagram of the main modules of the front end module loading apparatus according to the embodiment of the present invention. As shown in fig. 3, the front end module loading apparatus 300 according to an embodiment of the present invention includes:
the module management unit 301 obtains a module identifier and configuration attribute information of a module to be loaded; determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information;
a resource management unit 302, which loads module resources and dependent resources of the module to be loaded;
wherein, the module resource means: script resources, or script resources and cascading style sheet resources; the dependent resources of the module to be loaded refer to the dependent module of the module to be loaded and the extension module dependent on the module to be loaded.
Optionally, the configuration attribute information includes: the method comprises the steps of identifying a dependent module of a module to be loaded and an extended module of the module to be loaded;
the module management unit determines the dependent resources of the module to be loaded according to the configuration attribute information, and the method comprises the following steps: and determining the dependent module of the module to be loaded according to the dependent module identifier of the module to be loaded, and determining the expansion module of the module to be loaded according to the expansion module identifier of the module to be loaded.
Optionally, the resource management unit loads the dependent resource of the module to be loaded according to the following steps:
firstly, acquiring a dependent module of a module to be loaded, and acquiring an extension module of the module to be loaded after all dependent modules of the module to be loaded are acquired; sequentially taking the acquired dependency module and the expansion module as an element, and determining whether the element exists in a dependency resource set; if the element exists, the element in the dependent resource set is moved to the first position of the dependent resource set, otherwise, the element is placed into the first position of the dependent resource set; wherein initially the dependent resource set is an empty set.
Optionally, the front-end module loading apparatus according to the embodiment of the present invention further includes: and a packing unit (not shown in the figure) for merging and compressing the module resource and the dependent resource of the module to be loaded after the module resource and the dependent resource of the module to be loaded are loaded by the resource management unit.
According to another aspect of an embodiment of the present invention, there is provided a front-end module-loading electronic device.
The front-end module loading electronic device according to the embodiment of the invention comprises:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the front-end module loading method provided by the first aspect of the embodiments of the present invention.
Fig. 4 illustrates an exemplary system architecture 400 to which the front-end module loading method or front-end module loading apparatus of embodiments of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 305. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, 403 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 401, 402, 403. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the front-end module loading method provided by the embodiment of the present invention is generally executed by the server 405, and accordingly, the front-end module loading apparatus is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, shown is a block diagram of a computer system 500 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments 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 in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can 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 present invention, 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 the present invention, however, a computer readable signal medium may include 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 invention. In this regard, each block in the flowchart or block diagrams may represent a unit, 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor comprising: the module management unit is used for acquiring the module identification and the configuration attribute information of the module to be loaded; determining module resources of a module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to configuration attribute information; and the resource management unit loads module resources and dependent resources of the module to be loaded. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, a module management unit may also be described as "a unit that loads module resources and dependent resources of a module to be loaded".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring module identification and configuration attribute information of the module to be loaded; determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information; and loading the module resources and the dependent resources of the module to be loaded.
According to the technical scheme of the embodiment of the invention, the method has the following advantages or beneficial effects: the configuration attribute information of the module is used for analyzing the dependent resources, so that the required resources are automatically loaded, the aims of reducing the maintenance cost and developing the interface modularization are fulfilled, the network overhead is low, and the efficiency is high.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A front-end module loading method is characterized by comprising the following steps:
acquiring module identification and configuration attribute information of the module to be loaded;
determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information;
loading module resources and dependent resources of the module to be loaded;
wherein the module resource means: script resources, or script resources and cascading style sheet resources; the dependent resources of the module to be loaded refer to the dependent module of the module to be loaded and the extension module dependent on the module to be loaded.
2. The method of claim 1, wherein the configuration attribute information comprises: the method comprises the steps of identifying a dependent module of a module to be loaded and an extended module of the module to be loaded;
determining the dependent resources of the module to be loaded according to the configuration attribute information, including: and determining the dependent module of the module to be loaded according to the dependent module identifier of the module to be loaded, and determining the expansion module of the module to be loaded according to the expansion module identifier of the module to be loaded.
3. The method of claim 2, wherein the dependent resources of the module to be loaded are loaded as follows:
firstly, acquiring a dependent module of a module to be loaded, and acquiring an extension module of the module to be loaded after all dependent modules of the module to be loaded are acquired; sequentially taking the acquired dependency module and the expansion module as an element, and determining whether the element exists in a dependency resource set; if the element exists, the element in the dependent resource set is moved to the first position of the dependent resource set, otherwise, the element is placed into the first position of the dependent resource set; wherein initially the dependent resource set is an empty set.
4. The method of claim 3, wherein after loading module resources and dependent resources of the module to be loaded, further comprising: and merging and compressing the module resources and the dependent resources of the module to be loaded.
5. A front end module loading apparatus, comprising:
the module management unit is used for acquiring the module identification and the configuration attribute information of the module to be loaded; determining module resources of the module to be loaded according to the module identification, and determining dependent resources of the module to be loaded according to the configuration attribute information;
the resource management unit loads module resources and dependent resources of the module to be loaded;
wherein the module resource means: script resources, or script resources and cascading style sheet resources; the dependent resources of the module to be loaded refer to the dependent module of the module to be loaded and the extension module dependent on the module to be loaded.
6. The apparatus of claim 5, wherein the configuration attribute information comprises: the method comprises the steps of identifying a dependent module of a module to be loaded and an extended module of the module to be loaded;
the module management unit determines the dependent resources of the module to be loaded according to the configuration attribute information, and the method comprises the following steps: and determining the dependent module of the module to be loaded according to the dependent module identifier of the module to be loaded, and determining the expansion module of the module to be loaded according to the expansion module identifier of the module to be loaded.
7. The apparatus of claim 6, wherein the resource management unit loads the dependent resource of the module to be loaded according to the following steps:
firstly, acquiring a dependent module of a module to be loaded, and acquiring an extension module of the module to be loaded after all dependent modules of the module to be loaded are acquired; sequentially taking the acquired dependency module and the expansion module as an element, and determining whether the element exists in a dependency resource set; if the element exists, the element in the dependent resource set is moved to the first position of the dependent resource set, otherwise, the element is placed into the first position of the dependent resource set; wherein initially the dependent resource set is an empty set.
8. The apparatus of claim 7, further comprising: and the packing unit is used for merging and compressing the module resources and the dependent resources of the module to be loaded after the module resources and the dependent resources of the module to be loaded are loaded by the resource management unit.
9. A front-end module-loaded electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201810923025.7A 2018-08-14 2018-08-14 Front-end module loading method and device Pending CN110858240A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810923025.7A CN110858240A (en) 2018-08-14 2018-08-14 Front-end module loading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810923025.7A CN110858240A (en) 2018-08-14 2018-08-14 Front-end module loading method and device

Publications (1)

Publication Number Publication Date
CN110858240A true CN110858240A (en) 2020-03-03

Family

ID=69634781

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810923025.7A Pending CN110858240A (en) 2018-08-14 2018-08-14 Front-end module loading method and device

Country Status (1)

Country Link
CN (1) CN110858240A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608742A (en) * 2021-07-08 2021-11-05 阿里巴巴新加坡控股有限公司 Detection method, code packet processing method, operation control method and computing device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799640A (en) * 2012-06-27 2012-11-28 用友软件股份有限公司 Page loading device and page loading method
CN104965848A (en) * 2015-02-12 2015-10-07 腾讯科技(深圳)有限公司 Front-end resource loading method and apparatus
CN105159686A (en) * 2015-09-28 2015-12-16 北京奇虎科技有限公司 Website page development method and apparatus
CN105354049A (en) * 2015-09-29 2016-02-24 北京畅游天下网络技术有限公司 Resource loading method, apparatus and system for three-dimensional animation engine
CN106020891A (en) * 2016-05-25 2016-10-12 大唐网络有限公司 Page loading method and device
CN107704234A (en) * 2017-08-22 2018-02-16 北京三快在线科技有限公司 Front end engineering construction method, device, electronic equipment and readable storage medium storing program for executing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799640A (en) * 2012-06-27 2012-11-28 用友软件股份有限公司 Page loading device and page loading method
CN104965848A (en) * 2015-02-12 2015-10-07 腾讯科技(深圳)有限公司 Front-end resource loading method and apparatus
CN105159686A (en) * 2015-09-28 2015-12-16 北京奇虎科技有限公司 Website page development method and apparatus
CN105354049A (en) * 2015-09-29 2016-02-24 北京畅游天下网络技术有限公司 Resource loading method, apparatus and system for three-dimensional animation engine
CN106020891A (en) * 2016-05-25 2016-10-12 大唐网络有限公司 Page loading method and device
CN107704234A (en) * 2017-08-22 2018-02-16 北京三快在线科技有限公司 Front end engineering construction method, device, electronic equipment and readable storage medium storing program for executing

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608742A (en) * 2021-07-08 2021-11-05 阿里巴巴新加坡控股有限公司 Detection method, code packet processing method, operation control method and computing device

Similar Documents

Publication Publication Date Title
CN107832045B (en) Method and apparatus for cross programming language interface conversion
CN109683998B (en) Internationalization realization method, device and system
CN107844324B (en) Client page jump processing method and device
CN109766082B (en) Method and device for application program page jump
CN110020329B (en) Method, device and system for generating webpage
CN111104479A (en) Data labeling method and device
CN113010405A (en) Application program testing method and device
CN112818026A (en) Data integration method and device
CN111427899A (en) Method, device, equipment and computer readable medium for storing file
CN113452733A (en) File downloading method and device
CN112948138A (en) Method and device for processing message
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN110858240A (en) Front-end module loading method and device
CN112486482A (en) Page display method and device
CN113779122B (en) Method and device for exporting data
CN113779018A (en) Data processing method and device
CN110209959B (en) Information processing method and device
CN110647327A (en) Method and device for dynamic control of user interface based on card
CN111179164A (en) Method and device for generating thumbnail
CN112784195A (en) Page data publishing method and system
CN112131287A (en) Method and device for reading data
CN110019030B (en) Method and device for dividing file
CN113765868B (en) Service processing method and device
CN112860268B (en) Method and device for hot deployment of templates
CN113553489B (en) Method, device, equipment, medium and program product for capturing content

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