Method and system for loading module based on JavaScript

A module loading and cyclic loading technology, which is applied in the direction of program loading/starting, program control devices, etc., can solve the problems of poor code readability, low maintainability, and low reusability, and achieve good readability and high practicality High performance, applicability and reusability

Inactive Publication Date: 2017-07-14
北京思特奇信息技术股份有限公司
View PDF6 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0008] The technical problem to be solved by the present invention is to provide a JavaScript-based module loading method and system for the problems of poor code readability, low maintainability, low reusability and error-prone in the development process of the existing dynamic loading technology

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and system for loading module based on JavaScript
  • Method and system for loading module based on JavaScript

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0045] The principles and features of the present invention are described below in conjunction with the accompanying drawings, and the examples given are only used to explain the present invention, and are not intended to limit the scope of the present invention.

[0046] Such as figure 1 As shown, it is a schematic flowchart of a JavaScript-based module loading method provided by an embodiment of the present invention, and the method includes:

[0047] S101. Obtain multiple html modules and combination information between multiple html modules, and store them in a configuration file as configuration data;

[0048] S102, calling the loading function through JavaScript code, and reading the configuration data from the configuration file;

[0049] S103, according to the configuration data, cyclically load multiple html modules, and respectively obtain the files to be loaded of each html module;

[0050] S104, extracting the content to be loaded and the position information of ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention relates to a method and a system for loading a module based on JavaScript. The method comprises the following steps: obtaining a plurality of html modules and combination information of the plurality of html modules, using as configuration data to store in a configuration file; calling a loading function through JavaScript codes, reading the configuration data from the configuration file; according to the configuration data, performing circulating loading on the plurality of html modules, to respectively obtain a to-be-loaded file of each html module; extracting to-be-loaded contents and position information of element regions from the to-be-loaded file; and rendering the to-be-loaded contents to the element regions corresponding to the position information. The method for loading a module based on JavaScript is advantaged by good code readability, high maintainability, and high reusing degree, and in a development process, html is compiled by a module method, and the method would not make mistake caused by missing of splicing symbols.

Description

technical field [0001] The invention relates to the field of front-end development, in particular to a JavaScript-based module loading method and system. Background technique [0002] When people use the Internet to browse the web, the content displayed on the web page comes from the html page code. In the current Internet environment, more and more content needs to be displayed on the web page, and users have higher and higher requirements for user experience. The loading speed of html pages is the most important part of user experience. In order to improve the loading speed, the previous method of writing all the codes in one html file can no longer meet the demand. [0003] Therefore, the existing front-end development technology tends to be modularized, and the functional codes that need to be implemented are encapsulated in different files and dynamically loaded on demand. However, the existing dynamic loading technologies are all through splicing html strings in JavaSc...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F9/44G06F9/445
Inventor 罗国俊
Owner 北京思特奇信息技术股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products