Is there a way to short circuit async/await flow?
<p>All four functions called below in <code>update</code> return promises.</p>
<pre class="lang-js prettyprint-override"><code>async function update() {
   var urls = await getCdnUrls();
   var metadata = await fetchMetaData(urls);
   var content = await fetchContent(metadata);
   await render(content);
   return;
}
</code></pre>
<p>What if we want to abort the sequence from outside, at any given time?</p>
<p>For example, while <code>fetchMetaData</code> is being executed, we realize we no longer need to render the component and we want to cancel the remaining operations (<code>fetchContent</code> and <code>render</code>). Is there a way to abort/cancel these operations from outside the <code>update</code> function?</p>
<p>We could check against a condition after each <code>await</code>, but that seems like an inelegant solution, and even then we will have to wait for the current operation to finish.</p>