Category Archives: JavaScript

Building Dojo Toolkit

Basics

  • Build system for JavaScript resources and CSS files
  • Dojo build refers to concept to the concepts of minification, optimization, concatenation and “dead-code” removal.

Building Dojo Toolkit Involves

  1. Consolidates multiple modules into a single JavaScript file (Layer)
  2. Interns standalone template strings into Javascript files
  3. Minify the size of layers by removing white spaces, line breaks, comments and shortening variable names
  4. Copy build files to standalone directory (server deployable ready)

Resources

Arcgis server proxy

ArcGIS Server Proxy – using proxy page

ArcGIS Server Proxy

Server side code that runs on application server. It intercepts traffic between ArcGIS web application client and ArcGIS server.

Why ArcGIS Server Proxy ?

  • Browser limit of URL length for GET requests (JavaScript API)
  • To use token based authentication
  • Put Business Logic in Proxy, logging etc.
  • Hide ArcGIS server details from client ( IP Address, rest interface)

How to use ArcGIS Server Proxy in web application?

  • Define the location of proxy in client application. ( object of esri/config module)
  • esriConfig.defaults.io.proxyUrl = "<url_to_proxy>"
    esriConfig.defaults.io.alwaysUseProxy = false;
  • Can also set proxy-rule – If the request URL matches a rule, then the request will be routed through the proxy (object of esri/urlUtils module)
     urlUtils.addProxyRule({
              urlPrefix: "route.arcgis.com",
              proxyUrl: "<url_to_proxy>"
            });

What ArcGIS Server Proxy ideally should not to use for?

  • De-serialize requests of images (MapCache, dynamic layers)
  • The geometry, since it will impact performance. Get & pass a String directly.

Resources:

JavaScript Developers Time Saving Tips

JavaScript Developers Time Saving Tips:

Code Quality Tools:

Beautifiers:

Some JavaScript Style Guides:

Task Automation:

Automate tasks like minification, compilation, unit testing, linting and more.