<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: map vs app.map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218854#M20316</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;In the print widjet example, all the application specific values are now in window.app (map, printer, symbols, toolbar).&lt;BR /&gt;It's a method of organizing the code in the application.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You got it. Nothing more to it... trying to avoid polluting the global namespace. To answer the quasi-question, I didn't run into any conflicts with existing object/libraries while writing that sample.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Aug 2012 14:55:30 GMT</pubDate>
    <dc:creator>derekswingley1</dc:creator>
    <dc:date>2012-08-20T14:55:30Z</dc:date>
    <item>
      <title>map vs app.map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218852#M20314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the new print widget the examples show the map being defined as: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; var app = {}; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; app.map = null,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; app.map = new esri.Map("map", { &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extent: initialExtent, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wrapAround180: true &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this is compared to just :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map = new esri.Map.........&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can some please explain what is happening with the variable "app"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 13:12:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218852#M20314</guid>
      <dc:creator>p_thibault</dc:creator>
      <dc:date>2012-08-20T13:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: map vs app.map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218853#M20315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It looks like the sample was written to keep application specific objects in their own namespace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, when you write&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var map = new esri.Map("map");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'map' is bound to the Window object of the browser, which is basically the global namespace.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By declaring&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var app = {}; // This is an empty object, equivalient to window.app app.map = new esri.Map("map"); // map is now bound to window.app.map&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the print widjet example, all the application specific values are now in window.app (map, printer, symbols, toolbar).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a method of organizing the code in the application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's interesting that it's done in the Print Widget, I don't think I've seen it in other esri js samples before. It's not a strict rule, more of a best practices kind of thing to keep the global namespace clean. It's not mentioned their coding guidelines. In this case maybe there are othe common libraries that may already have a window.printer object defined and they wanted to avoid overrriding it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 13:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218853#M20315</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2012-08-20T13:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: map vs app.map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218854#M20316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;In the print widjet example, all the application specific values are now in window.app (map, printer, symbols, toolbar).&lt;BR /&gt;It's a method of organizing the code in the application.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You got it. Nothing more to it... trying to avoid polluting the global namespace. To answer the quasi-question, I didn't run into any conflicts with existing object/libraries while writing that sample.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 14:55:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-vs-app-map/m-p/218854#M20316</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-08-20T14:55:30Z</dc:date>
    </item>
  </channel>
</rss>

