seajs 的研究一 --- 无题

main.js

define(function(require, exports, module) {

	var person = require("../test/test2.js");
	var module3 = require("../test/test3.js");

	var main = {}

	main.init = function(){
		module3.init();
	}
	
	module.exports = main;
});

test1.js

define(function(require, exports, module) {

	var object = {};

	module.exports = object;
});

test2.js

define(function(require, exports, module) {
	var module1 = require("./test1");

	var object = {"name":"lifeixiang"};

	module1.preson = object;

	module.exports = object;
});

test3.js

define(function(require, exports, module) {
	var module1 = require("./test1");

	var object = {};

	object.init = function(){
		console.log(module1.preson)
	}

	module.exports = object;
});
posted @ 2013-05-19 16:13  zhepama  阅读(275)  评论(0编辑  收藏  举报