<?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: How to know when the map is correctly displayed in the browser ? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175675#M16332</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have to check if the layers were created (otherwise it considered the map as ready when there where no layers in the list):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;function isReady() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (view.allLayerViews.length == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; view.allLayerViews.length; i++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (view.allLayerViews.items&lt;I&gt;.updating) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;
}

function waitReady() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isReady()) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.print();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.setTimeout(waitReady, 10);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/I&gt;&lt;/CODE&gt;&lt;I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:08:44 GMT</pubDate>
    <dc:creator>RobinChappatte</dc:creator>
    <dc:date>2021-12-12T16:08:44Z</dc:date>
    <item>
      <title>How to know when the map is correctly displayed in the browser ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175673#M16330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;(Please excuse my english)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I have to fire a 'window.print()' when the map is entierely displayed in the browser.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I tried to use 'view.then()' but the map is still not displayed when the 'then' event occure...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;My solution is to use 'setTimeout' in the 'then' event, and to wait 1 second, but that doesn't sounds correct to me to do this...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Is there a way to know / detect / check is the map is correctly displayed ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Thank you in advance for your answers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Robin Chappatte&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2016 11:12:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175673#M16330</guid>
      <dc:creator>RobinChappatte</dc:creator>
      <dc:date>2016-05-26T11:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to know when the map is correctly displayed in the browser ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175674#M16331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; How about looping through the MapView.allLayerViews and check the updating property of each layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2016 11:42:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175674#M16331</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-05-26T11:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to know when the map is correctly displayed in the browser ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175675#M16332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have to check if the layers were created (otherwise it considered the map as ready when there where no layers in the list):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;function isReady() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (view.allLayerViews.length == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; view.allLayerViews.length; i++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (view.allLayerViews.items&lt;I&gt;.updating) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;
}

function waitReady() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isReady()) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.print();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.setTimeout(waitReady, 10);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/I&gt;&lt;/CODE&gt;&lt;I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:08:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175675#M16332</guid>
      <dc:creator>RobinChappatte</dc:creator>
      <dc:date>2021-12-12T16:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to know when the map is correctly displayed in the browser ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175676#M16333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to set back this thread as unresolved but after many tests I detect bad case where the print is launched but tiles still missing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By setting the timeout to a lower value, it fails more often... &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/cry.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I don't give up and still looking for a way to detect it &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/silly.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2016 18:34:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175676#M16333</guid>
      <dc:creator>RobinChappatte</dc:creator>
      <dc:date>2016-05-26T18:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to know when the map is correctly displayed in the browser ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175677#M16334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After several tests, the only thing I can suppose is that the browser take time to display the tiles, and the attribute updating goes to false as soon as the layer received the data, regardless of whether they are displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My solution consist in adding a setTimeout between the "isReady" and the printing launch:&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-weight: inherit; font-style: inherit;"&gt;function waitReady() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isReady()) {&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-weight: inherit; font-style: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.setTimeout(function() {&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-weight: inherit; font-style: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.print();&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-weight: inherit; font-style: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, 100); // 100ms of security for letting the browser display&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.setTimeout(waitReady, 10);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2016 19:09:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-know-when-the-map-is-correctly-displayed-in/m-p/175677#M16334</guid>
      <dc:creator>RobinChappatte</dc:creator>
      <dc:date>2016-05-26T19:09:44Z</dc:date>
    </item>
  </channel>
</rss>

