New to Dojo and I am just trying to get a basic Hello world module working in dojo/MVC and can't seem to get it to work. I keep getting either
no response / errors at all or cryptic Syntax errors in dojo.js e() h.injectUrl/h()
is what it says when using FireFox / Firebug. I am using 1.8 and have tried both the CDN and local copies.
Here is the code below.
Index.cshtml
<script src="~/Scripts/dojo/dojo.js" data-dojo-config="async: true, isDebug: true, parseOnLoad: true"></script><script>
// Require default stuff and new module
require([
"~/Scripts/dojoDemo/newModule"
],
function (newModule) {
newModule.setText("greetings", "Hello peoples");
settimeout(function () {
newModule.restoreText("greeting");
}, 3000);
});</script><h1 id="greetings">What up</h1>
<br/>
<br/>
newModule.js
define([
// Define the dependencies
"dojo/dom"],
// Create this function to call new module
function (dom) {
var oldText = {};
return {
setText: function (id, text) {
var node = dom.byId(id);
oldText[id] = node.innerHTML;
node.innerHTML = text;
},
restoreText: function (id) {
var node = dom.byId(id);
node.innerHTML = oldText[id];
delete oldText;
}
};
});