0
道场1.10+有没有办法检测自定义模块是否存在?
我希望有条件地加载自定义模块根据这个帖子
Dojo FAQ: How can I conditionally load AMD modules?
require([
'dojo/has'
], function (has) {
var ui;
var moduleId = 'myApp/ui/';
// Assume 'has' tests for mobile and tablet
// have been defined
if (has('mobile')) {
moduleId += 'Mobile';
}
else if (has('tablet')) {
moduleId += 'Tablet';
}
else {
moduleId += 'Desktop';
}
require([moduleId], function (UiModule) {
ui = new UiModule();
ui.placeAt(document.body);
ui.startup();
});
});
但是似乎道场/只检测到某些道场功能。如果是这种情况,是否有另一种方法来检测自定义模块是否存在,然后尝试请求,然后实例化它,如果它的一个小部件?