While loop and async function

I found a way to do what I need. I used a recorsive function to get the value from the plugin callback and wait it.

getP()
 {
        this.try3().then(ID => {
          console.log("id: "+ID);
          if(ID=="xxx")
            //do stuff
          this.getP();
        }).catch(error => {
            console.log("ERR:" + error)
        });
  }

Thanks for the advices @rapropos