Promise to async await when polling
问题 I'm trying to convert a function that uses promise (and polling) to an async function, but I'm not really sure how it works. I have this: function myFunction() { return new Promise(resolve => { // stuff here ... var poll = setInterval(function() { if (condition) { clearInterval(poll); resolve("done"); } }, 100); }); } .. but I'm unsure what to await here: async function myFunction() { // stuff here ... var poll = setInterval(function() { if (condition) { clearInterval(poll); // await what? }