var myservice = (function() {
var me = this;
me.reportInfo = {};
this.setReportInfo = function(data){
me.reportInfo = data;
};
this.getReportInfo = function(){
return me.reportInfo;
};
return me;
})();
怎么将这一个js文件的内容定义为AMD规范的模块化,就像jQuery,我直接在require.config()引入,在其他多个不同的js文件中直接就可以使用myservice这个调用里面的任意一个方法。
题主你都说jQuery了,参考一下jQuery的实现?
摘自jQuery 2.0源码片段
这样?