<script src="c1Use.js">
--|
| c1Use.js
|
| jQuery.js
|
| jQuery |
| | fn |
| | velocity.js
|
| JSON.js // JSON-Polyfill
// load jQuery async:
window.c1Use('jQuery', function($) {
$('#test').addClass('xy')
});// if there is no callback-function, its syncron
window.c1Use('JSON').parse( '{a:1,b:2}' );c1Use.addGetter(window, 'JSON'); // JSON-polyfill for old browsers
// now, "JSON" is magicly usable
// the *JSON" poilyfill is not loaded at this moment!!!
JSON.parse( '{a:1,b:2}' ); window.c1Use('jQuery', function($) { // "jQuery" is automaticly usable width c1Use because loaded with c1Use.
c1Use.able(jQuery, 'fn'); // make "jQuery.fn" usable
c1Use.addGetter( jQuery.fn, 'velocity' );
// later: in your code
$('#text').velocity( {color:red} );
})window.c1Use(['jQuery', 'mytool'], function($, mytool) {
// use $ and mytool
})// optional ( fallback is the dir in the scripts-tags src )
window.c1UseSrc = '/url/to/libs';MIT