假设我在 require 语句中时需要测试变量。如果存在,为了访问我需要的变量,哪种方法是最好的?有没有办法改变上下文?
somefunction: function(id) {
var test ="xxx";
require(['models/Model', 'views/View'], function(ArticleModel, ArticleView) {
var collection = new Collection();
// I need to access the TEST variable HERE
});
}