How to use Dojo CDN + my.name.space.widget?

I want to use the Dojo CDN version, but I also want to use my widget collection in my own namespace. How to make two games together?

+4
source share
2 answers

You also need to modify djConfig.baseUrl . The module file path is a combination of djConfig.baseUrl and the module path if the relative path is used in the 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 information can be found at Cross-Domain Dojo .

+1
source

You need to configure djConfig.modulePaths to point to your own modules. For exmaple:

modulePaths: {"com.yourdomain", "/js/com/yourdomain"}

0
source

Source: https://habr.com/ru/post/1303715/


All Articles