标签:
http://www.cnblogs.com/snandy/archive/2012/03/12/2390782.html
AMD设计出一个简洁的写模块API:
define(id?, dependencies?, factory);
其中:
//base.js define(function() { return { mix: function(source, target) { } }; }); //ui.js define([‘base‘], function(base) { return { show: function() { // todo with module base } } }); //page.js define([‘data‘, ‘ui‘], function(data, ui) { // init here }); //data.js define({ users: [], members: [] });
define(‘index‘, [‘data‘,‘base‘], function(data, base) {
    // todo
});
define(function(require, exports, module) {
    var base = require(‘base‘);    exports.show = function() {        // todo with module base    }});标签:
原文地址:http://www.cnblogs.com/coding4/p/5585688.html