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;
}
});
Did you check this article from esri guide? It may help you in writing a class.