AnsweredAssumed Answered

ReferenceError: declare is not defined

Question asked by aconnolly on Apr 23, 2013
Latest reply on Apr 23, 2013 by aconnolly

I'm trying to write my first DOJO class and re-use it within a very simple application, however I can't figure out why the `declare` method in DOJO is not defined?

Here is my DOJO class code in a separate file: mapManager.js

// mapManager

require(['dojo/_base/declare'], function(declare){      delcare("mapManager", null,   {   sourceMapNode: null,   maxZoomResolution: 10,    constructor: function(params){       this.params = params || {}; // Returns a object literal if undefined       // specifiy class defaults    this.sourceMapNode = params.sourceMapNode;    this.maxZoomResolution = params.maxZoomResolution;        // Hook up map movement events    alert("Hooking up map move events!");   }  }); });

Here is the index page that sets up the ESRI SDK, includes my special class and attempts to instantiate it.

<!DOCTYPE html> <html>   <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">     <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>     <title>Simple Map</title>     <link rel="stylesheet" href="">     <link rel="stylesheet" href="">     <style>       html, body, #map {         height:100%;         width:100%;         margin:0;         padding:0;       }       body {         background-color:#FFF;         overflow:hidden;         font-family:"Trebuchet MS";       }     </style>     <script src=""></script>     <script src="script/class/mapManager.js"></script>     <script>              dojo.require("mapManager");          function init() {                          var parameters = {                 sourceMapNode : "map",                 mapZoomResolution: 12                         };                        // Give map to map manager             var mapManager = new omega.mapManager(parameters);                      }                    dojo.ready(init);            </script> </head> <body class="claro">     <div id="map"></div> </body> </html> 

In Firebug the first error I see is:

ReferenceError: delcare is not defined
[Break On This Error] 

delcare("mapManager", null,

The second error I see is a 404 error:

"NetworkError: 404 Not Found -"

Two questions:

1. What am I doing wrong? I have followed tutorials on DOJO's website and this should be working. Of course I have missed something important, I'm sure.
2. Why is custom class mapManager.js assumed to be a part of the DOJO library provided by ESRI? The second error indicates that the page "thinks" mapManager.js is part of the ESRI library when infact it's available locally.