title: Lifecycle stores
body: <p>Are there stores for component lifecycle events? That is, instead of passing a function to e.g. onMount, can I instead <code>await onMount()</code>. <code>await tick()</code> seems to be the closest thing, but I was wondering if there's a store for the onMount event specifically or a way to create that store.</p>
  <p>My usecase is Stripe Elements in Svelte.</p>
  <p>Two asynchronous processes have to complete, and I can't guarantee which will happen first:</p>
  <ol>
  <li>Stripe's js file has loaded (&lt;svelte:head src=... on:load={render}&gt;)</li>
  <li>the component has rendered (onMount)</li>
  </ol>
  <p>Rather than write code for both cases</p>
  <pre class="lang-js prettyprint-override"><code>let event1Happened = false, event2Happened = false;
  onEvent1(() =&gt; { event1Happened = true; if (event2Happened) { render() } });
  onEvent2(() =&gt; { event2Happened = true; if (event1Happened) { render() } }); 
  </code></pre>
  <p>can I just write something like</p>
  <p><code>onEvent1(() =&gt; { await event2; render(); })</code></p>
  <p>or</p>
  <p><code>await event1; await event2; render();</code>?</p>
  <p>or use an event modifier like</p>
  <p><code>&lt;svelte:head src=... on:load|mounted={render}&gt;</code></p>