Promises before function is ran

173
0
06-30-2021 04:40 PM
BrandonPrice2
Occasional Contributor

Hello:

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]);
          promises
.then(handleQueryResults);

 

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 = this.map.toScreen(mpPt);
          this.map.emit("click", { 
            bubbles: true, 
            cancelable: true, 
            mapPoint: mpPt,
            screenPoint: scrPt
          });
        }),1400);

 

 

 

0 Kudos
0 Replies