title: Vue Async Components - How to resolve with emitted event
body: <p>I like to set up a Vue async component such that it is in a loading state (and hence will render the specified loading component) until a custom event is emitted.</p>
  
  <p>So, something like</p>
  
  <pre><code>const AsyncComponent = () =&gt; ({
    component: () =&gt; new Promise( resolve =&gt; import(’./MyComponent.vue’)
      .then(component =&gt; component.$emit.on(‘customLoadedEvent’, resolve))
    ),
    loading: LoadingComponent,
    error: ErrorComponent,
    delay: 200,
    timeout: 3000
  })
  </code></pre>
  
  <p>Is something like that easily configurable?</p>