if you want to create a WebGIS you probably have heard the name of the arcgis javascript api.
The ArcGIS Javascript API is created by the esri developers. the Dojo is embede in the arcgis library.
so in this tutorial i am going to show you how to add a reference to the ArcGis javascript API.
there are many sources for getting dojo on the internet ...but in my opinion the best one is the esri server
the below lines of codes show how to get access to all functionality of dojo and the ArcGIS Javascript API
ArcGIS javascript API..included Dojo
you have to pay attention to when you have a reference to the Arcgis JS API you also will have lasted version of DOJO
If you pay attention to these codes you would find that I was going to use the 4.15 version.This version of the library can load 3d maps and do a lot of stuff on the 3d scene.
Although this capability does not exist in the 3.x version but many of the projects were implemented by 3.x version and upgrading to 4.x version will have some costs.
so 3.x version is still a useful library for learning and using in your project
let's coming back to our discussion.
At fist I want to shw you an example that you probably have done it by the jquery.
Suppused taht you hame an element on yor Html page anf you want to get InnerHtml of your emelent
so you have to get ths element or in the other word you have to get a refrence to this element
below line is showing that
$(document).ready(function () {
var InnerText= $("#div1").html()
})
in this section after loading page , we are rady to get inner text of the an elemetn which its id id 'div1'
Dojo in very similar to pervious code
require(["dojo/dom"], function(dom){
// fetch a node by id="someNode"
var node = dom.byId("Div1");
});
here are many thing that you have to know before diving into dojo
the require function in the module loader of Dojo.it has 2 argument .number one is the an Array of modules that we want to load in project and The nummber two is a function
this function could get an argument...each argument in this function will be mapped to each module that is loaded in the require function.
For example in the previous sample The dom argument that has been passed to function will be a reference to the "dojo/dom" module.
Dojo and iquery are very similar to each other.so learning Dojo will not be very hard for Jquery.programmers
here i should say
best place for using Dojo is when you want to create a the web gis using the Arcgis Javascript API.
in the next articles i will show you how to create the Mosules and reusabale code in Dojo.
I hope you find this article is helpful