CN109240756A - A kind of method and device of dynamically load JavaScript module - Google Patents
A kind of method and device of dynamically load JavaScript module Download PDFInfo
- Publication number
- CN109240756A CN109240756A CN201810738793.5A CN201810738793A CN109240756A CN 109240756 A CN109240756 A CN 109240756A CN 201810738793 A CN201810738793 A CN 201810738793A CN 109240756 A CN109240756 A CN 109240756A
- Authority
- CN
- China
- Prior art keywords
- module
- javascript
- identification information
- called
- loading
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
Abstract
The embodiment of the invention provides a kind of method and devices of dynamically load JavaScript module.Wherein, which comprises receive dlm (dynamic loading module) instruction;It include: the identification information of each module to be called in the dlm (dynamic loading module) instruction;According to the identification information of each module to be called, it loads in default first function library, the corresponding each first JavaScript module of identification information of each module to be called, and each module corresponding position to be called described in layout page, show the corresponding each first JavaScript module of identification information of each module to be called.Using scheme provided in an embodiment of the present invention, the loading velocity of JavaScript module can be improved.
Description
Technical field
The present invention relates to field of computer technology, a kind of method more particularly to dynamically load JavaScript module and
Device.
Background technique
JavaScript is a kind of based on object and event-driven and with the client-side scripting language of relative safety, together
When be also one kind be widely used in client Web (World Wide Web, WWW) exploitation scripting language, be commonly used to HTML
(HyperText Markup Language, hypertext markup language) webpage adds dynamic function.
In html page exploitation, a page is composed of on demand multiple modules.Currently, being developed in html page
In the process, need to load whole JavaScript modules simultaneously, then, needed for calling in the JavaScript module of load
The JavaScript module wanted assists the exploitation of html page.However, the load side of current this JavaScript module
Formula once needs module to be loaded excessive, influences the speed of load.
Summary of the invention
The method and device for being designed to provide a kind of dynamically load JavaScript module of the embodiment of the present invention, to mention
The loading velocity of high JavaScript module.Specific technical solution is as follows:
In a first aspect, the embodiment of the invention provides a kind of method of dynamically load JavaScript module, the method
Include:
Receive dlm (dynamic loading module) instruction;It wherein, include: each mould to be called in the dlm (dynamic loading module) instruction
The identification information of block;
According to the identification information of each module to be called, loads in default first function library, is described each
The corresponding each first JavaScript module of the identification information of a module to be called, and it is each described in layout page
The module corresponding position to be called shows the identification information corresponding each first of each module to be called
JavaScript module.
Optionally, each first JavaScript module in the default first function library are as follows: previously according to
Family demand is write and is saved.
Optionally, before receiving dlm (dynamic loading module) instruction, the method also includes:
It loads in the 2nd JavaScript module and default third function library in default second function library
3rd JavaScript module;
Wherein, the 2nd JavaScript module includes: the selector of the multiple infrastructure elements or object that encapsulate in advance
Corresponding JavaScript module;
The 3rd JavaScript module includes: corresponding to the multiple preset attributes encapsulated in advance and function
JavaScript module.
Optionally, the function of each first JavaScript module in the default first function library, is to be based on
What the selector in the 2nd JavaScript module defined.
Optionally, in loading default first function library, the identification information of the modules corresponding each the
Before one JavaScript module, the method also includes:
Preset module loading function is called, by the identification information of the modules corresponding each first
JavaScript module loading is into memory.
Second aspect, the embodiment of the invention also provides a kind of device of dynamically load JavaScript module, the dresses
It sets and includes:
Instruction receiving unit, for receiving dlm (dynamic loading module) instruction;It include: each in the dlm (dynamic loading module) instruction
The identification information for the module to be called;
First module loading unit, for the identification information according to each module to be called, load default the
In one function library, the corresponding each first JavaScript module of the identification information of each module to be called,
And each module corresponding position to be called described in layout page, show the mark of each module to be called
The corresponding each first JavaScript module of information.
Optionally, each first JavaScript module in the default first function library are as follows: previously according to
Family demand is write and is saved.
Optionally, described device further include: the second module loading unit;
The second module loading unit, for loading the 2nd JavaScript module in default second function library
With the 3rd JavaScript module in default third function library;
Wherein, the 2nd JavaScript module includes: the selector of the multiple infrastructure elements or object that encapsulate in advance
Corresponding JavaScript module;
The 3rd JavaScript module includes: corresponding to the multiple preset attributes encapsulated in advance and function
JavaScript module.
Optionally, the function of each first JavaScript module in the default first function library, is to be based on
What the selector in the 2nd JavaScript module defined.
Optionally, described device further include: third module loading unit;
The third module loading unit, for calling preset module loading function, by the mark of the modules
The corresponding each first JavaScript module loading of information is into memory.
The third aspect, the embodiment of the invention also provides a kind of electronic equipment, including processor, communication interface, memory
And communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes a kind of dynamic described in above-mentioned first aspect
The method for loading JavaScript module.
Fourth aspect, it is described computer-readable to deposit the embodiment of the invention also provides a kind of computer readable storage medium
Instruction is stored in storage media, when run on a computer, so that computer executes one kind described in above-mentioned first aspect
The method of dynamically load JavaScript module.
5th aspect, the embodiment of the invention also provides a kind of computer program products comprising instruction, when it is being calculated
When being run on machine, so that computer executes a kind of method of dynamically load JavaScript module described in above-mentioned first aspect.
A kind of method and device of dynamically load JavaScript module provided in an embodiment of the present invention receives dynamically load
Module instruction;It include: the identification information of each module to be called in dlm (dynamic loading module) instruction;It to be adjusted according to each
The identification information of module loads in default first function library, the identification information of each module to be called corresponds to
Each first JavaScript module, and each module corresponding position to be called in layout page shows each wants
The corresponding each first JavaScript module of the identification information of called module.In the embodiment of the present invention, added using dynamic
The mode of load loads JavaScript module, is instructed according to dlm (dynamic loading module), phase required for targetedly loading
Close module, do not need the whole JavaScript module of load, can to avoid loading excessive unwanted JavaScript module,
Improve the loading velocity of JavaScript module.
Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above excellent simultaneously
Point.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow chart of dynamically load JavaScript modular approach provided in an embodiment of the present invention;
Fig. 2 is the flow chart of another dynamically load JavaScript modular approach provided in an embodiment of the present invention;
Fig. 3 is the flow chart of another dynamically load JavaScript modular approach provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of dynamically load JavaScript modular device provided in an embodiment of the present invention;
Fig. 5 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In order to solve the prior art in html page development process, need to load whole JavaScript moulds simultaneously
Then block calls required JavaScript module to assist opening for html page in the JavaScript module of load
The problem of hair, the loading method of this JavaScript module once need module to be loaded excessive, influence the speed of load.
The embodiment of the invention provides a kind of method and devices of dynamically load JavaScript module, and JavaScript mould can be improved
The loading velocity of block.
In order to solve above-mentioned prior art problem, a kind of dynamically load JavaScript module provided in an embodiment of the present invention
Method, this method comprises:
Receive dlm (dynamic loading module) instruction;It include: each module to be called in the dlm (dynamic loading module) instruction
Identification information;According to the identification information of each module to be called, loads in default first function library, is described each
The corresponding each first JavaScript module of the identification information of a module to be called, and it is each described in layout page
The module corresponding position to be called shows the identification information corresponding each first of each module to be called
JavaScript module.
It can be seen that the embodiment of the present invention, loads JavaScript module by the way of dynamically load, according to
Dlm (dynamic loading module) instruction, correlation module required for targetedly loading do not need the whole JavaScript module of load,
The loading velocity of JavaScript module can be improved to avoid excessive unwanted JavaScript module is loaded.
A kind of information interacting method based on barrage is provided for the embodiments of the invention first below to be introduced.
As shown in FIG. 1, FIG. 1 is a kind of dynamically load JavaScript modular approach provided in an embodiment of the present invention, the party
Method may include:
S110 receives dlm (dynamic loading module) instruction;It wherein, include: each to be called in dlm (dynamic loading module) instruction
The identification information of module.
In html page development process, needs to load and call JavaScript module to assist opening for html page
Hair.Wherein, which can be what rear end developer was pre-created, and different JavaScript modules is specific
Different identification informations.
In the embodiment of the present invention, the dlm (dynamic loading module) received for JavaScript module is instructed, the dynamically load mould
The identification information of each module to be called is contained in block instruction.Wherein, dlm (dynamic loading module) instruction is sent out by user
Out, which can be rear end developer etc..The mark for the module to be called for including in dlm (dynamic loading module) instruction
Know the targeted JavaScript module of information, it is either one or more, in the embodiment of the present invention, for the dynamic
The number of the identification information for the module to be called that loading module instruction is included is with no restriction.
In addition, the dlm (dynamic loading module) instructs, it can be rear end developer and edit in advance, and be stored in for software
In the device memory of exploitation.Dlm (dynamic loading module) instruction, is corresponding with the movement of execution, when needing to develop html page, after
End developer issues dlm (dynamic loading module) instruction, after the equipment for developing html page receives the instruction, is setting
The instruction is inquired in standby memory, and executes its corresponding movement.Certainly, the application is only illustrated with above-mentioned implementation,
Implementation in practical application for dlm (dynamic loading module) instruction is not limited to that.
S120 is loaded in default first function library, Ge Geyao according to the identification information of each module to be called
The corresponding each first JavaScript module of the identification information of called module, and each in layout page to be called
Module corresponding position, show the corresponding each first JavaScript module of identification information of each module to be called.
Optionally, each first JavaScript module in the default first function library are as follows: previously according to user
Demand is write and is saved.
In practical applications, which can compile for rear end developer previously according to user demand
It writes and saves, include multiple and different the first JavaScript module in the default first function library.It is a kind of optional
Implementation are as follows: can be in page development initial stage, demand of the rear end developer according to user to product, according to different functions
Demand analysis is carried out, each required function in the page is obtained and then for required function, writes comprising multiple and different
The first JavaScript module the first function library and save.
Wherein, it presets in the first function library, all specifically its is corresponding for each the first different JavaScript module
Identification information, and, the identification information of each the first different JavaScript module is user to default first function text
It is write and creates completion during being saved in part library.
In the embodiment of the present invention, each module to be called included in dlm (dynamic loading module) instruction is being received
It, can be according to the identification information of each module to be called, in default first function library, inquiry after identification information
With the identification information for the module to be called, the first JavaScript module with same identification information.In default first function
Can in library, inquire each first JavaScript module corresponding to the identification information of each module to be called it
Afterwards, the identification information of each module to be called is corresponding each in the default first function library that load is inquired
First JavaScript module.And in layout page each module corresponding position to be called, it to be called each
The corresponding each first JavaScript module of the identification information of module is shown.
Wherein, layout page can be, at page development initial stage, demand of the rear end developer according to user to product,
Edit the layout page generated.Or during page development, rear end developer is according to product demand, editor
The layout page of generation.Specifically, the generating mode of layout page, this is not restricted by the present invention.
Optionally, each module to be called all is corresponding with location information in the layout page, the location information parameter,
It can be added when generating the page layout, be also possible to included in the instruction of received dlm (dynamic loading module), this
When, the dlm (dynamic loading module) instruction in include: each module to be called identification information and each module to be called
Corresponding location information.Certainly, the application is only illustrated with above-mentioned implementation, each in layout page in practical application
The implementation of all corresponding location information of the module to be called is not limited to that.
It illustratively, may include multiple and different first in the embodiment of the present invention, in the default first function library
JavaScript module, multiple the first different JavaScript module can be expressed as multiple js files, each file pair
Answer a specific function.Such as: Tabs.js can be used to encapsulate the function of switch card effect, and Imgs.js can be used to encapsulate
The function of picture carousel, Wins.js can be used to encapsulate the function of floating frame, and Menus.js can be used to encapsulate multistage drop-down
The function etc. of menu.
A kind of method of dynamically load JavaScript module provided in an embodiment of the present invention receives dlm (dynamic loading module) and refers to
It enables;It include: the identification information of each module to be called in dlm (dynamic loading module) instruction;According to each mould to be called
The identification information of block, load is preset in the first function library, the identification information of each module to be called is corresponding each
First JavaScript module, and each module corresponding position to be called in layout page, display is each to be called
Module the corresponding each first JavaScript module of identification information.In the embodiment of the present invention, using the side of dynamically load
Formula loads JavaScript module, is instructed according to dlm (dynamic loading module), correlation module required for targetedly loading,
The whole JavaScript module of load is not needed, can be improved to avoid excessive unwanted JavaScript module is loaded
The loading velocity of JavaScript module.
In order to solve prior art problem, on the basis of embodiment shown in Fig. 1, as shown in Fig. 2, Fig. 2 is that the present invention is real
The flow chart of another dynamically load JavaScript modular approach of example offer is applied, this method can also include:
S100 loads the 2nd JavaScript module in default second function library and default third function library
In the 3rd JavaScript module;
Wherein, the 2nd JavaScript module includes: that the selector institute of the multiple infrastructure elements or object that encapsulate in advance is right
The JavaScript module answered;
3rd JavaScript module includes: JavaScript corresponding to the multiple preset attributes encapsulated in advance and function
Module.
A kind of optional implementation in the embodiment of the present invention are as follows: before receiving dlm (dynamic loading module) instruction, Ke Yijia
Carry the third in the 2nd JavaScript module and default third function library in default second function library
JavaScript module.The 2nd JavaScript module and default third function library in the default second function library
In the 3rd JavaScript module, be also possible to what rear end developer write and saved previously according to user demand.
Specifically, the 2nd JavaScript module includes: the selector of the multiple infrastructure elements or object that encapsulate in advance
Corresponding JavaScript module.3rd JavaScript module includes: the multiple preset attributes encapsulated in advance and function institute
Corresponding JavaScript module.
Optionally, in the embodiment of the present invention, the default second function library can based on library, it includes the
Two JavaScript modules can be expressed as Base.js file, comprising: the selection of the multiple infrastructure elements or object that encapsulate in advance
JavaScript module corresponding to device.Illustratively, the selector of infrastructure elements or object can be with are as follows: the object of incoming id,
The object of incoming tag name, is passed to the collection object of name (title), is passed to the collection object of class (class) name, creation
XMLHttpRequest (expansible hypertext transfer request) object executes either synchronously or asynchronously request event etc..
Optionally, in the embodiment of the present invention, which can be active file library, it includes the
Three JavaScript modules can be expressed as Comment.js file, comprising: multiple preset attributes and the function institute encapsulated in advance
Corresponding JavaScript module.Illustratively, preset attribute and function can be with are as follows: for object addition, delete monitoring event, resistance
Element property event is deleted in only bubbling event, addition, and element inline style event is deleted in addition, and class thing is deleted in addition
Part obtains the visible field width degree of screen or height, obtains object width or height, obtains pair relative to Body (function body) element
The offset offsetTop (upper offset) and offsetLeft (left offset) of elephant, hide, display elements function, obtain one
A random number, obtains current time, and setting puts into collection, book mark function etc..
Optionally, the function of presetting each first JavaScript module in the first function library is based on second
What the selector in JavaScript module defined.
In the embodiment of the present invention, the function of each first JavaScript module in the first function library is preset, it can
Being defined based on the selector in the 2nd JavaScript module.Specifically, the 2nd JavaScript module can be based on
The selector of packaged object in Base.js, to define the function of the first JavaScript module.When first
When the function needs of JavaScript module use common setting, also can be used attribute packaged in Comment.js and
Function defines.
A kind of method of dynamically load JavaScript module provided in an embodiment of the present invention receives dlm (dynamic loading module) and refers to
It enables;It include: the identification information of each module to be called in dlm (dynamic loading module) instruction;According to each mould to be called
The identification information of block, load is preset in the first function library, the identification information of each module to be called is corresponding each
First JavaScript module, and each module corresponding position to be called in layout page, display is each to be called
Module the corresponding each first JavaScript module of identification information.In the embodiment of the present invention, using the side of dynamically load
Formula loads JavaScript module, is instructed according to dlm (dynamic loading module), correlation module required for targetedly loading,
The whole JavaScript module of load is not needed, can be improved to avoid excessive unwanted JavaScript module is loaded
The loading velocity of JavaScript module.
In order to solve prior art problem, on the basis of embodiment shown in Fig. 2, as shown in figure 3, Fig. 3 is that the present invention is real
The flow chart of another dynamically load JavaScript modular approach of example offer is applied, this method can also include:
S130 calls preset module loading function, by the identification information of modules corresponding each first
JavaScript module loading is into memory.
A kind of optional implementation in the embodiment of the present invention are as follows: receiving the mark comprising each module to be called
After knowing the dlm (dynamic loading module) instruction of information, preset module loading function can be called, by the identification information of modules
Corresponding each first JavaScript module loading is into memory, so as to page development use.
In practical applications, can be arranged each in advance for each JavaScript module editted
The corresponding module loading function of JavaScript module, then, by the identification information of modules corresponding each first
JavaScript module loading is into memory, during facilitating page development, is receiving comprising each module to be called
Identification information dlm (dynamic loading module) instruction when, corresponding to the identification information of each module to be called each first
The calling of JavaScript module.
Optionally, during page development, when page left and right side respectively needs a switch card effect, page bottom
It, can be in the identification information for receiving the called module of the needs comprising these three functions when needing a picture wheel multicast function
Dlm (dynamic loading module) instruction after, the first JavaScript module that the identification information of these three functional modules is answered is adjusted
With.Can also be with, in advance by each first JavaScript module loading into memory, when receiving the need comprising these three functions
After the dlm (dynamic loading module) instruction of the identification information for the module to be called, these three functional modules are directly called in memory
The first JavaScript module answered of identification information.Certainly, each first JavaScript module is added in practical application
Load mode is not limited to that.
A kind of method of dynamically load JavaScript module provided in an embodiment of the present invention receives dlm (dynamic loading module) and refers to
It enables;It include: the identification information of each module to be called in dlm (dynamic loading module) instruction;According to each mould to be called
The identification information of block, load is preset in the first function library, the identification information of each module to be called is corresponding each
First JavaScript module, and each module corresponding position to be called in layout page, display is each to be called
Module the corresponding each first JavaScript module of identification information.In the embodiment of the present invention, using the side of dynamically load
Formula loads JavaScript module, is instructed according to dlm (dynamic loading module), correlation module required for targetedly loading,
The whole JavaScript module of load is not needed, can be improved to avoid excessive unwanted JavaScript module is loaded
The loading velocity of JavaScript module.
Corresponding to above method embodiment, the embodiment of the invention provides a kind of dresses of dynamically load JavaScript module
It sets, as shown in figure 4, Fig. 4 is a kind of structural representation of dynamically load JavaScript modular device provided in an embodiment of the present invention
Figure, the apparatus may include:
Instruction receiving unit 401, for receiving dlm (dynamic loading module) instruction;Include: in the dlm (dynamic loading module) instruction
The identification information of each module to be called;
First module loading unit 402, for the identification information according to each module to be called, load is default
In first function library, the corresponding each first JavaScript mould of the identification information of each module to be called
Block, and each module corresponding position to be called described in layout page show each module to be called
The corresponding each first JavaScript module of identification information.
A kind of device of dynamically load JavaScript module provided in an embodiment of the present invention receives dlm (dynamic loading module) and refers to
It enables;It include: the identification information of each module to be called in dlm (dynamic loading module) instruction;According to each mould to be called
The identification information of block, load is preset in the first function library, the identification information of each module to be called is corresponding each
First JavaScript module, and each module corresponding position to be called in layout page, display is each to be called
Module the corresponding each first JavaScript module of identification information.In the embodiment of the present invention, using the side of dynamically load
Formula loads JavaScript module, is instructed according to dlm (dynamic loading module), correlation module required for targetedly loading,
The whole JavaScript module of load is not needed, can be improved to avoid excessive unwanted JavaScript module is loaded
The loading velocity of JavaScript module.
It should be noted that the device of the embodiment of the present invention is and a kind of dynamically load JavaScript mould shown in FIG. 1
The corresponding device of the method for block, a kind of all embodiments of the method for dynamically load JavaScript module shown in FIG. 1 are suitable
For the device, and it can reach identical beneficial effect.
Optionally, each first JavaScript module in the default first function library are as follows: previously according to
Family demand is write and is saved.
Optionally, described device further include: the second module loading unit;
The second module loading unit, for loading the 2nd JavaScript module in default second function library
With the 3rd JavaScript module in default third function library;
Wherein, the 2nd JavaScript module includes: the selector of the multiple infrastructure elements or object that encapsulate in advance
Corresponding JavaScript module;
The 3rd JavaScript module includes: corresponding to the multiple preset attributes encapsulated in advance and function
JavaScript module.
Optionally, the function of each first JavaScript module in the default first function library, is to be based on
What the selector in the 2nd JavaScript module defined.
Optionally, described device further include: third module loading unit;
The third module loading unit, for calling preset module loading function, by the mark of the modules
The corresponding each first JavaScript module loading of information is into memory.
The embodiment of the invention also provides a kind of electronic equipment, as shown in figure 5, include processor 501, communication interface 502,
Memory 503 and communication bus 504, wherein processor 501, communication interface 502, memory 503 are complete by communication bus 504
At mutual communication,
Memory 503, for storing computer program;
Processor 501 when for executing the program stored on memory 503, is realized provided by the embodiment of the present invention
Method.
A kind of electronic equipment provided in an embodiment of the present invention receives dlm (dynamic loading module) instruction;The dlm (dynamic loading module) refers to
It include: the identification information of each module to be called in order;According to the identification information of each module to be called, load is pre-
If in the first function library, the corresponding each first JavaScript module of the identification information of each module to be called,
And each module corresponding position to be called in layout page, show that the identification information of each module to be called is corresponding
Each first JavaScript module.In the embodiment of the present invention, by the way of dynamically load to JavaScript module into
It goes and loads, instructed according to dlm (dynamic loading module), correlation module required for targetedly loading does not need load whole
JavaScript module can improve JavaScript module to avoid excessive unwanted JavaScript module is loaded
Loading velocity.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with instruction in storage medium, when run on a computer, so that computer executes any institute in above-described embodiment
The method for a kind of dynamically load JavaScript module stated, to obtain identical technical effect.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it
When running on computers, so that computer executes any a kind of dynamically load JavaScript mould in above-described embodiment
The method of block, to obtain identical technical effect.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meter
Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or
Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or
It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with
It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk
Solid State Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence " including one ... ", it is not excluded that
There is also other identical elements in the process, method, article or apparatus that includes the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (10)
1. a kind of method of dynamically load JavaScript module characterized by comprising
Receive dlm (dynamic loading module) instruction;It wherein, include: each module to be called in the dlm (dynamic loading module) instruction
Identification information;
According to the identification information of each module to be called, loads in default first function library, described each wants
The corresponding each first JavaScript module of the identification information of called module, and it is each described in layout page will quilt
The module corresponding position of calling shows the identification information corresponding each first of each module to be called
JavaScript module.
2. the method according to claim 1, wherein each first in the default first function library
JavaScript module are as follows: write previously according to user demand and save.
3. the method according to claim 1, wherein receive dlm (dynamic loading module) instruction before, the method
Further include:
Load the third in the 2nd JavaScript module and default third function library in default second function library
JavaScript module;
Wherein, the 2nd JavaScript module includes: that the selector institute of the multiple infrastructure elements or object that encapsulate in advance is right
The JavaScript module answered;
The 3rd JavaScript module includes: JavaScript corresponding to the multiple preset attributes encapsulated in advance and function
Module.
4. according to the method described in claim 3, it is characterized in that, each first preset in the first function library
The function of JavaScript module is defined based on the selector in the 2nd JavaScript module.
5. according to the method described in claim 3, it is characterized in that, in loading default first function library, it is described each
Before the corresponding each first JavaScript module of the identification information of module, the method also includes:
Preset module loading function is called, by the corresponding each first JavaScript mould of the identification information of the modules
Block is loaded onto memory.
6. a kind of device of dynamically load JavaScript module characterized by comprising
Instruction receiving unit, for receiving dlm (dynamic loading module) instruction;Include: in dlm (dynamic loading module) instruction it is each will quilt
The identification information of the module of calling;
First module loading unit loads default first function for the identification information according to each module to be called
Can in library, the corresponding each first JavaScript module of identification information of each module to be called, and
Each module corresponding position to be called described in layout page shows the identification information of each module to be called
Corresponding each first JavaScript module.
7. device according to claim 6, which is characterized in that each first in the default first function library
JavaScript module are as follows: write previously according to user demand and save.
8. device according to claim 6, which is characterized in that described device further include: the second module loading unit;
The second module loading unit, for loading the 2nd JavaScript module in default second function library and pre-
If the 3rd JavaScript module in third function library;
Wherein, the 2nd JavaScript module includes: that the selector institute of the multiple infrastructure elements or object that encapsulate in advance is right
The JavaScript module answered;
The 3rd JavaScript module includes: JavaScript corresponding to the multiple preset attributes encapsulated in advance and function
Module.
9. device according to claim 8, which is characterized in that each first in the default first function library
The function of JavaScript module is defined based on the selector in the 2nd JavaScript module.
10. device according to claim 8, which is characterized in that described device further include: third module loading unit;
The third module loading unit, for calling preset module loading function, by the identification information of the modules
Corresponding each first JavaScript module loading is into memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810738793.5A CN109240756A (en) | 2018-07-06 | 2018-07-06 | A kind of method and device of dynamically load JavaScript module |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810738793.5A CN109240756A (en) | 2018-07-06 | 2018-07-06 | A kind of method and device of dynamically load JavaScript module |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109240756A true CN109240756A (en) | 2019-01-18 |
Family
ID=65071865
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810738793.5A Pending CN109240756A (en) | 2018-07-06 | 2018-07-06 | A kind of method and device of dynamically load JavaScript module |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109240756A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110262846A (en) * | 2019-05-07 | 2019-09-20 | 平安科技(深圳)有限公司 | Interface loading method, system, computer equipment and storage medium based on module |
CN111290799A (en) * | 2020-02-06 | 2020-06-16 | 北京字节跳动网络技术有限公司 | Component loading method and device, electronic equipment and storage medium |
CN111857689A (en) * | 2020-07-27 | 2020-10-30 | 深信服科技股份有限公司 | Framework, function configuration method of framework, terminal and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7536389B1 (en) * | 2005-02-22 | 2009-05-19 | Yahoo ! Inc. | Techniques for crawling dynamic web content |
CN102073686A (en) * | 2010-12-24 | 2011-05-25 | 汉柏科技有限公司 | Vertical dynamic loading method of page document and device thereof |
US20120304159A1 (en) * | 2011-05-27 | 2012-11-29 | Luis Ceze | Hardware support for hashtables in dynamic languages |
CN108090159A (en) * | 2017-12-12 | 2018-05-29 | 福建中金在线信息科技有限公司 | A kind of generation method of Website page, device, electronic equipment and storage medium |
-
2018
- 2018-07-06 CN CN201810738793.5A patent/CN109240756A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7536389B1 (en) * | 2005-02-22 | 2009-05-19 | Yahoo ! Inc. | Techniques for crawling dynamic web content |
CN102073686A (en) * | 2010-12-24 | 2011-05-25 | 汉柏科技有限公司 | Vertical dynamic loading method of page document and device thereof |
US20120304159A1 (en) * | 2011-05-27 | 2012-11-29 | Luis Ceze | Hardware support for hashtables in dynamic languages |
CN108090159A (en) * | 2017-12-12 | 2018-05-29 | 福建中金在线信息科技有限公司 | A kind of generation method of Website page, device, electronic equipment and storage medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110262846A (en) * | 2019-05-07 | 2019-09-20 | 平安科技(深圳)有限公司 | Interface loading method, system, computer equipment and storage medium based on module |
CN111290799A (en) * | 2020-02-06 | 2020-06-16 | 北京字节跳动网络技术有限公司 | Component loading method and device, electronic equipment and storage medium |
CN111290799B (en) * | 2020-02-06 | 2023-09-19 | 北京字节跳动网络技术有限公司 | Component loading method and device, electronic equipment and storage medium |
CN111857689A (en) * | 2020-07-27 | 2020-10-30 | 深信服科技股份有限公司 | Framework, function configuration method of framework, terminal and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104866383B (en) | Interface calling method and device and terminal | |
CN104426925B (en) | Web page resources acquisition methods and device | |
CN109062626A (en) | Exchange method, device and the equipment of Web page component and Native component | |
CN104035753A (en) | Double-WebView customized page display method and system | |
CN106294372A (en) | Application program page quick access method and apply its mobile terminal | |
CN106339414A (en) | Webpage rendering method and device | |
US20150278171A1 (en) | Single page application authoring in a content management system | |
US8682851B2 (en) | Device specific folders for bookmark synchronization | |
CN113010827B (en) | Page rendering method and device, electronic equipment and storage medium | |
CN109240756A (en) | A kind of method and device of dynamically load JavaScript module | |
CN110598135A (en) | Network request processing method and device, computer readable medium and electronic equipment | |
WO2017107851A1 (en) | Method and device for releasing and updating desktop application component | |
CN106201562A (en) | A kind of page switching method and device | |
CN105373548A (en) | Mobile device and event self-definition method for browser of mobile device | |
CN112783783A (en) | Webpage point burying method, device and equipment and readable storage medium | |
CN109684571A (en) | A kind of collecting method and device, storage medium | |
CN109144392A (en) | A kind of method, apparatus and electronic equipment handling gesture conflict | |
CN110069734A (en) | A kind of page assembly shows method and apparatus | |
CN110866208B (en) | Page response type layout method, device and equipment | |
CN109101600A (en) | The crawling method and device of dynamic data in a kind of webpage | |
CN104731817B (en) | A kind of webpage exhibiting method and device | |
CN106649299A (en) | Method and device for lazy loading of webpage block | |
CN104572981B (en) | A kind of Webpage method for caching and processing and mobile terminal device | |
US20140337709A1 (en) | Method and apparatus for displaying web page | |
CN109558129A (en) | Progress bar implementation method and device |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190118 |
|
WD01 | Invention patent application deemed withdrawn after publication |