No description, website, or topics provided.
JavaScript PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.textile
index.php
jquery.use.js
test.js

README.textile

Readme

Options

  • Set base url
    jQuery.use.base = ‘http://example.com’;
  • Use a combine file as get args
    jQuery.use.combine = true;
  • Setup the modules
    jQuery.use.modules = {
    ‘test1’ : { ‘path’: ‘assets/scripts/test1.js’ },
    ‘test2’ : { ‘path’: ‘assets/scripts/test2.js’, ‘require’: ‘test1’ },
    ‘test3’ : { ‘path’: ‘assets/scripts/test3.js’, ‘require’: [‘test1’, ‘test2’] },
    ‘test4’ : { ‘path’: ‘assets/scripts/test4.js’ },
    ‘test5’ : { ‘path’: ‘assets/scripts/test5.js’, ‘require’: [‘test4’] }
    };

Examples

Get the required files on the page

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://github.com/m64253/jQuery-use/raw/master/jquery.use.js"></script>

This should only load the “test1”

jQuery.use('test1', function($){
	console.log('LOADED: "test1"');
});

This should only load the test2 module, as the test1 module should already be loaded

jQuery.use('test2', function($){
	console.log('LOADED: "test2"');
});

This should fire off as soon the earlier test2 use is loaded

jQuery.use('test2', function($){
	console.log('LOADED: "test2"');
});

This should only load the test3 module, as test1, test2 modules should already be loaded

jQuery.use('test3', function($){
	console.log('LOADED: "test3"');
});

This should only load both the the test4 and test5 module, test5 requires test4

jQuery.use('test5', function($){
	console.log('LOADED: "test5"');
});

This should fire off as soon as the earlier test3 and test5 are done

jQuery.use(['test3', 'test5'], function($){
	console.log('LOADED: "test3, test5"');
});

This should fire off directly, uses no modules

jQuery.use(function($){
	console.log('LOADED: "none"');
});