Adding ArcGIS JS Direction widget in separate function

المشرف العام

Administrator
طاقم الإدارة
I am working with ArcGIS JS library, I am trying to add direction widget in my code, and it is working fine. I am following this example:https://developers.arcgis.com/javascript/jssamples/widget_directions_basic.html

Now, what I want to do is to add direction widget in separate function and return its object to the calling function, but I am getting undefined when I log returned object. Is ArcGIS JS adding widget asynchronously? If it is then is there any way to add this widget synchronously? I studied the documentation and couldn't find anything related to this. I want to access its object in calling function and I have to initialize this widget in another function. And also, I cannot use global variable for this widget.

Attached is my code, any help would be greatly appreciated.

Directions Widget html, body, #map { height:100%; width:100%; margin:0; padding:0; } body { background-color:#FFF; overflow:hidden; font-family:"Trebuchet MS"; }





أكثر...
 
أعلى