tags:

views:

47

answers:

1

I need to change the dojo namespace to something else. I found this stackoverflow post, but it refers to a dojo documentation page that no longer exists. Below is something I tried based on this page, but didn't 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!

+4  A: 

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

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

For your specific example, the djConfig object needs to be declared in a script tag before the Dojo file loads, and it is recommended that you map dijit and dojox too:

<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"&gt;&lt;/script&gt;

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