Skip to content

useWait

Vue composable for handling wait plugins

WARNING

You must install the wait plugin before using it

TIP

More info about the wait plugin in its documentation

Usage

Loaded

vue
<template>
  <MazFullscreenLoader v-if="wait.isLoading('MAIN_LOADER')">
    Loading
  </MazFullscreenLoader>
  <p v-else> Loaded </p>
</template>

<script lang="ts" setup>
  import { onMounted } from 'vue'
  import { useWait, sleep } from 'maz-ui'

  const wait = useWait()

  onMounted(async () => {
    wait.start('MAIN_LOADER')
    await sleep(2000)
    wait.stop('MAIN_LOADER')
  })
</script>