Skip to content

kellyhutchins/DevSummit-2016-Demos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

WebAppsAndMaps

Demo scripts and code for Dev Summit 2015

Series of code samples showing common gotchas when working with the ArcGIS API for JavaScript

To test these samples download the contents of the DevSummit2016-Gotchas and set them up to run on your web server. Index.html has details about the included code samples.

Tips and Tricks for Developing and Debugging Web Apps using browser based developer tools.

Browser based tools to track down issues, inspect css, analyze performance and more.

All of the browser based dev tools have similar capabilites. We'll explore how to use these options to find and fix issues in your web apps.

Check out Chrome Canary or Firefox Developer Edition to explore the latest browser features and experiments.

Network Tab

Run the demo app with the dev tools open and inspect the network traffic. View the request and response info.

Demo App: Query Task

Security

Run the demo app with the dev tools open and view the console tab. Note there is a 'mixed-content' error due to the fact the the https page reqeusted some insecure content. To see details about which content is problematic click the Security tab (available in Chrome Dev Tools).

Demo App: Mixed Content Demo

Console

Open the dev tools to the console tab and run the demo app. Using the console you can log diagnostic info and enter commands to interact with the app. In this sample map is a global variable so we can access properties via the console.

// Get the current map extent 
map.geographicExtent

// Get the current map extent in JSON
JSON.stringify(map.geographicExtent)

Demo App: Console Demo

Debugging

Use dev tools to set breakpoints and step through your code. Set a breakpoint at line 94 of index.html. Use the tools to step through and inspect the code.

Demo App: Debug Demo

CSS

Use the Inspect Element tool to find out the css class names for widgets in the JSAPI.

Demo App: Directions

Snippets

Use snippets to run longer bits of code - can be used to replace bookmarklets. Here are the three esri-related snippets shown in the presentation. Note that these require that map be a global variable. Get Extent Snippet

(function(){require(["dojo/json"],function(j){console.log(j.stringify(function(){var e=map.extent.toJson();e.xmin=parseInt(e.xmin);e.ymin=parseInt(e.ymin);e.xmax=parseInt(e.xmax);e.ymax=parseInt(e.ymax);return e;}()));})})();

Get Center Snippet

(function(){
    var c= map.geographicExtent.getCenter();
    console.log([parseFloat(c.x.toFixed(3)), parseFloat(c.y.toFixed(3))]);
})();

Get Zoom Snippet

map.getLevel();

Chrome Snippets Firefox Scratchpad Demo Snippets

About

Demo code for Dev Summit 2016

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published