https://github.com/knowledgecode/lego.js
a lightweight module loader for client-side JavaScript
https://github.com/knowledgecode/lego.js
Last synced: 3 months ago
JSON representation
a lightweight module loader for client-side JavaScript
- Host: GitHub
- URL: https://github.com/knowledgecode/lego.js
- Owner: knowledgecode
- License: mit
- Created: 2012-05-25T15:44:20.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-06-06T03:17:19.000Z (about 13 years ago)
- Last Synced: 2025-01-30T19:52:31.229Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lego.js
lego.js is a lightweight module loader for client-side JavaScript. It is inspired by [CommonJS Modules](http://wiki.commonjs.org.mirrors.page.ca/articles/m/o/d/Modules.html), [RequireJS](https://github.com/jrburke/requirejs) and so on.## Features
* It supports AMD (Asynchronous Module Definition). But it is not fully compatible with RequireJS.
* It is CommonJS Modules compliant.
* It is small footprint (about 1KB, minified via Closure Compiler and gzipped).
* It dosen't pollute the global namespace.
* It works in Chrome, Firefox, Opera, Safari, Mobile Safari, Android Browser, and IE 6.0+.## Syntax
define function pattern 1(function (define) {
define([dependencies], function (require) {
// your code here
});}(lego.define));
define function pattern 2
(function (define) {
define(function () {
// your code here
});}(lego.define));
define function pattern 3
(function (define) {
define(id, [dependencies], function (require, exports, module) {
// your code here
});}(lego.define));
define function pattern 4
(function (define) {
define(id, [dependencies], function (require, exports, module) {
// your code here
}, baseId);}(lego.define));
## License
lego.js is available under the terms of the MIT license.