Select to view content in your preferred language

Creating a custom AMD widget with map as the base

1275
2
01-16-2013 10:30 AM
JamesVillanueva
Regular Contributor
Does anyone have an example of creating a custom map widget using the ESRI map as the base? My first attempt:

define([
    "esri/map",
    "dojo/_base/declare"
  ],
  function (map, declare)
{
  
  //widget declaration
  return declare("my.Map", [map],
  {
    constructor : function ()  {},
    
    postCreate : function ()
    {
      this.inherited(arguments);
      
    }
    
  }
  );
}
);


I ran into the following error: mixin #0 is not a callable constructor.
0 Kudos
2 Replies
ReneRubalcava
Esri Frequent Contributor
esr/map doesn't actully return an object, not last I checked.
You could try declare('mymap', [esri.Map], { ... });
0 Kudos
JamesVillanueva
Regular Contributor
That did the trick, thanks.
0 Kudos