Socket
Socket
Sign inDemoInstall

vue-pwa-installer

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-pwa-installer

Vue interface for installing Progressive Web Apps.


Version published
Weekly downloads
6
Maintainers
1
Install size
6.32 kB
Created
Weekly downloads
 

Readme

Source

Vue PWA Installer

Adds an $installer interface to Vue instances for installing Progressive Web Apps.

yarn add vue-pwa-installer

Setup

import Vue from "vue"
import VueInstaller from "vue-pwa-installer"

Vue.use(VueInstaller, { /* options */ })

Usage

<template>
  <div>
    <div v-if="$installer.canInstall">
      <button @click="$installer.prompt">
    </div>
    <p v-if="$installer.choice">
      User {{$installer.choice}} prompt.
    </p>
    <p v-if="$installer.hasInstalled">
      App installed successfully.
    </p>
  </div>
</template>

Interface

KeyTypeDescription
promptFunctionPrompt the user to install the PWA when available.
choiceString?User choice following prompt dialog. Either null, "accepted" or "dismissed".
canInstallBooleanCan the app be installed via prompt.
hasInstalledBooleanHas the app been installed.

NOTE: Support for the underlying API is limited.

Options

KeyTypeDefaultDescription
prototypeKeyString$installerVue prototype key to add the installer instance to.
storageKeyStringhasInstalledPWALocalStorage key to store installed state of the PWA.

Nuxt

To inject a PWA installer into a Nuxt application:

// plugins/installer.js
import Vue from "vue"
import { createInstaller } from "vue-pwa-installer"

export default (context, inject) => {
  const installer = createInstaller(Vue, { /* options */ })
  inject("$installer", installer)
}

The $installer interface will now be available in Vue components, Nuxt's app instance and the Vuex store.

Author

Matthew Wagerfield

License

MIT

Keywords

FAQs

Last updated on 15 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc