AnsweredAssumed Answered

Accessing the require block

Question asked by gilbertgis on Jun 22, 2017
Latest reply on Jun 27, 2017 by gilbertgis

Hi all,

Is there any way to "access" items in the require block from other javascript files?  I have created global variables for the view, for polygons & graphics, etc., and those are accessible, but one thing I need to access is the geometryEngine, and am unable to do that from another file.  I'm working on a pretty big application so I'm trying to keep things organized.  Or would I just put all my code in one file, inside the require block (that would be one really big fiile)?  I haven't done any major projects with js yet, this is the first, so I'm not sure how this is typically done.  The ESRI samples have all the code in one file but those are usually fairly small.

What I am actually trying to do is return geometry from a query, which works pretty well (I created a polygon / graphic / symbol as global variables).  However, sometimes the query returns multiple polygons, and I was trying to use the geometryEngine to merge them into one polygon (the other alternative would to be create a global array of polygons, but I didn't want to do that).

I was thinking maybe there's a way to "include" the javascript code from another file inside that block, instead of in the html header, so it's like one continuous inline file, but separated into multiple files? Is that possible?

Thanks in advance for your assistance.