Promise not working in arcgis js 4.19

526
2
06-27-2021 10:12 PM
RitikaManderwal
New Contributor III

i am trying to promise in arcgis js 4.19 .

code :

promise.all(layerPromises)

.then(()=>{

console.log("hello")

})

* * layerPromises我s an array of promises**

when i run this code in 4.17 it is working fine but with 4.19 not able to exceute it

Tags(1)
0Kudos
2回答
ReneRubalcava
Frequent Contributor II

Do you have a snippet showing what layer promises is doing? Are they layer.loads() or queries? If you add a .catch() what is the error message? You wouldn't happen to be using Angular are you?

0Kudos
RitikaManderwal
New Contributor III

hi,

i am not using angular it is javascript.

layerpromises are layer.loads().it is checking for everylayer loads successfully or not.

const fdwh = (view,featureLayer)=>{

try{

return new Promise((resolve,reject)=>{

view.whenLayerView(featureLayer).then((layerview) => {

watchutil.whenFalseOnce(layerView,"updating").then(()=>{

resolve();

}

}

}

}

}

for(var i =0;i

{

layerPromises.push(fdwh (view,featurelayerarray[i]))

}

promise.all(layerPromises)

.then(()=>{

console.log("hello")

})

0Kudos