allDoc.map(function(stage){
      for(let key of stage.layerItem){
          //key.toImage is a library, so it only supports callback.
          key.toImage({
              callback(img) {
                  addPhoto(key.attrs)
              }
          });
      }
})
// Run when addPhoto is done
console.log("done")
async function addPhoto(params){
  const stored = await s3.upload(params).promise()
  return stored.Location
}When the addPhoto function is completed, how do I proceed to the next code?
 
     
    