How do I use Dojo CDN + my.name.space.widget?
I want to use a CDN version of Dojo but 开发者_如何转开发I also want to use my collection of widgets in my own name space. How do I make the two play together?
You need to change djConfig.baseUrl
too. The path of a module file is a combination of djConfig.baseUrl
and module's path, if relative path is used in module path. See the example below.
<script type="text/javascript">
var djConfig = {
baseUrl : "./",
modulePaths : {"example" : "js/example"}
};
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4.0/dojo/dojo.xd.js
"></script>
<script type="text/javascript">
(function() {
dojo.require("example.Sample");
dojo.addOnLoad(function() {
new example.Sample().sayHello();
});
})();
</script>
More details can be found at Cross-Domain Dojo
.
You need to config djConfig.modulePaths
to point to your own modules. For exmaple:
modulePaths: {"com.yourdomain", "/js/com/yourdomain"}
精彩评论