# Async

A renderless component for awaiting promises to resolve; great for making HTTP requests. Supports showing pending, resolved, or rejected promises.

Features:

  • Provides abstraction for pending, error, and results logic for Promises.
  • Scoped slots for pending, rejected, and resolved states.

Source

# Installation

Globally:

// main.js
import Vue from "vue"
import { VAsync } from "vuetensils/src/components"

Vue.component("VAsync", VAsync)

Locally:

<script>
// SomeComponent.vue
import { VAsync } from "vuetensils/src/components"

export default {
  components: {
    VAsync,
  },
  // ...
}
</script>

This component is great for handling any asynchronous tasks that involve promises. For example, HTTP requests:

# Handle pending states

# Handle rejected errors

# Access full state with default scoped slot

# Dynamically assign promise

# Call promise using refs

Last Updated: 4/18/2020, 3:57:00 PM