我该如何在最新版本的RequireJS中使用Bing Maps API?远程脚本URL为:http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0。我只需要添加这样一个shim吗?
然后在我的模块中像这样使用它:
require.config({
/* ... */
paths: {
'Microsoft.Maps': 'http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0'
},
shim: {
'Microsoft.Maps': {
deps: [],
exports: 'Microsoft'
}
}
});
然后在我的模块中像这样使用它:
define(['Microsoft.Maps'], function(Microsoft) {
/* ... */
});
我想我的问题更多地涉及如何使用RequireJS中的命名空间代码。文档中没有我能找到的任何相关示例。