Promises before function is ran

06-30-2021 04:40 PM
by Anonymous User
Not applicable


I have a function in my web appbuilder developer app. I want the function to not run until the promise is returned that the top layer in my agol web map has resolved if the map is re-centered and the layer has to refresh first. I think the top layer in agol maps is identified as the highest [number] and bottom layer which is the basemap is [0] when using the api.  How do I set this promise?


Promise snippet I found and would like intergrated into the existing code:

 promises = all([parcels, buildings]);


Existing code:


setTimeout(lang.hitch(this, function(){
          var mpPt;
          if(result.feature.geometry.type === "point"){mpPt = result.feature.geometry;}

          //else{mpPt = result.feature.geometry.getExtent().getCenter();}
          var scrPt =;
"click", { 
            bubbles: true, 
            cancelable: true, 
            mapPoint: mpPt,
            screenPoint: scrPt




0 Kudos
0 Replies