Skip to content

bytedevzone/Dynamic-Loading-Javascript-Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Dynamic-Loading-Javascript-Module

Loading java script dynamically, And reduce html page loading time.

Usage

Include jquery.js and module.js file bottom of the html page before closing body tag

<script type="text/javascript" src="js/module.js"></script>

Call loadModules after loading page

$(window).load(function() {

	/* call after all modules loaded */
	
	function cm(){
	
	}


	/* call after individual module loaded
	*  cim call after loading js1 module
	*/

	function cim(){
	
	}

	/* call after loading window */


	
	Module.loadModules([
	                    {module:'path/to/your/js'},
	                    {module:'path/to/your/js1', callback:cim()},
	                    {module:'path/to/your/js2'},
	                    {module:'path/to/your/js3'}
	   ], {oncomplete:cm});
});

Options

module : path of module without .js extension

callback : callback function for individual module

oncomplete : callback functin after loading all modules

About

Loading java script dynamically, And reduce html page loading time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published