I have the following function that runs an interval internally until some work is complete:
doTasks() {
let myInterval = setInterval(() => {
// do some work
if(workComplete === true) {
clearInterval(myInterval);
}
},500);
}
How can i convert this function to return a resolved promise when the interval has been stopped?