Esri / storymap-shortlist

The Shortlist story map application template by Esri
http://storymaps.arcgis.com/en/app-list/shortlist/
Apache License 2.0
43 stars 61 forks source link

Why call function init() two times in file "app/js/main.js"? #55

Closed ly2015 closed 8 years ago

ly2015 commented 8 years ago

What is written in file "app/js/main.js" is as follows:

dojo.addOnLoad(function() {_dojoReady = true;init();}); jQuery(document).ready(function() {_jqueryReady = true;init();});


Could I call function init() only one time? and How?

glazou commented 8 years ago

Yes but you shouldn't need this. This allow the app to handle well case where jquery may be loaded in a different order.

The init function will be called twice but the first thing that function does is to check that both jQuery and Dojo are loaded so the code should only be executed once, see https://github.com/Esri/shortlist-storytelling-template-js/blob/master/app/js/main.js#L96