My goal is to create a while loop that encapsulates a promise, ensuring that my method runs until a specific condition is satisfied. I've attempted to do this, but unfortunately encountered an issue with infinite promises being generated, eventually leading to a stack overflow.
I am aiming to achieve something similar to the TypeScript code snippet below:
while (responseSuccess === false) {
myClass.executeScript.then((thisWasSuccessful: boolean) => {
responseSuccess = thisWasSuccessful;
});
Although it may seem unconventional, the script I have developed sends a request to the server which the application typically handles. There are cases where the request does not return success on the first attempt, or even after multiple tries (which is beyond my control).