Header configuration in viewer.js
- Proxy - URLS to proxy services
- Geometry Service
- Google Maps API Key (for Google Streetview and other widgets that may require the Google API)
- Other preinitialization logic
Esri Configuration options in viewer.js
By default the following properties are set:
esriConfig.defaults.io.proxyUrl = 'proxy/proxy.ashx'; esriConfig.defaults.io.alwaysUseProxy = false; esriConfig.defaults.geometryService = new GeometryService('https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer');
You may also configure proxy rules by adding
'esri/urlUtils' to your amd
define block and function. Make sure the order of your module strings match the order of the modules listed in your function.
By default the Google Maps loader is already imported to viewer.js, and you can set the key using the
Other initialization scripts
If there are other initializations you would like to perform, the header area of the viewer.js is one option. For example, by default a
buildImageParameters function is defined which is used later to help us create Dynamic Map Service layer Image Parameters
In addition, as an example we have added a topic registration. This demonstrates how the layer control's menu topic works. However in the real world, it is best to keep these extra functions minimal and perhaps separate them into a different module or even build a separate widget. This will increase your possibilities of reusing the code in other CMV and Dojo apps.