The JavaScript module loader is based on [AMD] (https://github.com/amdjs/amdjs-api/blob/master/AMD.md). lodJS is the best implemented understanding of [AMD] (https://github.com/amdjs/amdjs-api/blob/master/AMD.md) up to now.
100% supports AMD specifications. Supports modular development. When a module is defined, modules can be used without maintaining a dependent module, just write a dependency, and lodJS will automatically be responsible for the dependency injection.
- Modular Development Support
- Asynchronous loading
- Dependency injection
- Flexible custom functionality
- Safari 6+ (Mac)
- iOS 5+ Safari
- Chrome 23+ (Windows, Mac, Android, iOS, Linux, Chrome OS)
- Firefox 4+ (Windows, Mac, Android, Linux, Firefox OS)
- Internet Explorer 6+ (Windows, Windows Phone)
- Opera 10+ (Windows, linux, Android)
<script src="lodjs.js"></script>
$ bower install lodjs
$ bower install git://github.com/yanhaijing/lodjs.git
We use lodJS's global function define to define a module, for example, in mod.js, we have the following code:
define(function () {
return 123;
});
The use method in lodJS uses a module. The following code can use the module defined above:
lodjs.use('mod', function (mod) {
console.log(mod);// Outputs 123
});
For more examples, please see the directory of demo.
If you want to contribute code for lodJS, please use fork + pull request method, ensuring that before you launch pr, you rebase code on the master branch to your own branch.
$ bower register lodjs git://github.com/yanhaijing/lodjs.git
yanhaijing