snowuly / modulejs

It's a small library to support nodejs style coding in browser javascript environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

modulejs

It's a small library to support nodejs style coding in browser javascript environment

It's compatible with commonjs module spec, see http://wiki.commonjs.org/wiki/Modules/1.1

	define(id, [des], factory);
	Module.use(ids, callback);
	
	//Example
	define('./b', function (require, exports, module) {
		module.exports = { name: 'Tony' }
	});
	define('./a', function (require, exports, module) {
		var b = require('./b');
		return { say: function () {
			console.log(b.name);
			} 
		}
	});
	
	Module.use('./a', function (a) {
		a.say(); // Tony
	});

What about CMD&AMD... Writing this just for fun lol...Surely Seajs and RequireJS are much more powerful

About

It's a small library to support nodejs style coding in browser javascript environment

License:MIT License


Languages

Language:JavaScript 100.0%