AnsweredAssumed Answered

write and load custom dojo class

Question asked by bforbhavin on Aug 18, 2014
Latest reply on Apr 22, 2015 by Yusufamro

How can I write my custom dojo class that I can add with require([..]) like other ArcGIS JS classes? I created one module (or class) like following so, I can keep some of the code in this class for reusability.

 

//file name for following module let's say ESRI.js

 

define(['esri/layers/GraphicsLayer',

  'esri/symbols/SimpleMarkerSymbol',

  'esri/symbols/SimpleFillSymbol',

  'esri/symbols/SimpleLineSymbol',

  'esri/symbols/TextSymbol',

  'esri/Color',

  'esri/symbols/Font',

  'esri/geometry/Circle',

  'esri/geometry/Polygon',

  'esri/units',

  'esri/tasks/query',

  'esri/tasks/QueryTask'],

  function(GraphicsLayer, SimpleMarkerSymbol, SimpleFillSymbol, SimpleLineSymbol, TextSymbol, Color, Font,

  Circle, Polygon, Units, Query, QueryTask){

return {

  getMap: function() {

  return this.map;

  },

  setMap: function(map) {

  this.map = map;

  }

});

Outcomes