I have a question about JavaScript language (unfortunately I do not know it very well). To realize my web application (based on AWS Cognito), I'm using asynchronous methods, like this:
this.cognitoIdentityServiceProvider.listUsers(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else { console.log(data) // successful response
}
});
My problem is that I absolutely need to save the "data object" in a data field of a class to use it and graphically display in the frontend of the application. Unfortunately I try a lot od days, but I could not copying these important data in any way (I need it as data fields of my class!!). I tried with the promises and the callbacks but I could not get anything!
It's possible can convert this asynchronous method to a synchronous method and wait for the application until the data object is recovered? If is impossibilet, how can I get this data object as a data field in my class?
Thanks a lot!