Skip to content

vin100bk/requireJs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

requireJs

Lightweight and very simple JS require

Examples of use :

Init

<script src="pathtojs/require.js"></script>
require.init({
    'alias1': 'path/file1.js',
    'alias2': 'path/file2.js',
    'alias3': 'path/file3.js',
    'alias4': 'path/file4.js',
});

Call

require.get('alias1').done(function() {
	// Script loaded, we can use it
})
.fail(function() {
	
});

You can use then() as well and enjoy its chaining power:

require.get('alias1').then(function() {
	// Script loaded, we can use it
	return $aValue;
})
.then(function($aValue) {
	// You can use the value computed in the previous then statement 
});

Dependencies

  • JQuery

About

Lightweight JS require

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published