App Visibility

Quasar makes use of the Web Page Visibility API which lets you know when a website/app is visible or in focus.

Installation


// quasar.conf.js

return {
  framework: {
    plugins: [
      'AppVisibility'
    ]
  }
}

Usage

// outside of a Vue file
import { AppVisibility } from 'quasar'

(Boolean) AppVisibility.appVisible

// inside of a Vue file
(Boolean) this.$q.appVisible
AppVisibility



Watching for status change

<template>...</template>

<script>
export default {
  watch: {
    '$q.appVisibile' (val) {
      console.log(val ? 'App became visible' : 'App went in the background')
    }
  }
}
</script>

AppVisibility API