Change dojo namespace

I need to change the dojo namespace to something else. I found this stackoverflow post, but it links to a dojo documentation page that no longer exists. Below I tried based on this page, but did not work:

<html>
<head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js" djConfig="scopeMap: [[ 'dojo', 'newns' ]]"></script>

    <script>
          newns.addOnLoad(function(){
                console.debug("hello world");
          });
    </script>
</head>
<body>
</body>
</html>

Help!

+3
source share
1 answer

I just pulled the document from the old Dojo book and put it in the new doc system:

http://docs.dojocampus.org/multiversion/index

In your specific example, the djConfig object must be declared in the script tag before the Dojo file is loaded, and it is also recommended to match dijit and dojox:

<html>
<head>
    <script>
        var djConfig = {
            scopeMap: [
                ['dojo', 'newns'],
                ['dijit', 'newnsw'],
                ['dojox', 'newnsx']

            ]
        }
    </script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js"></script>

    <script>
          newns.addOnLoad(function(){
                console.debug("hello world");
          });
    </script>
</head>
<body>
</body>
</html>
+4
source

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


All Articles