0.1.0 • Published 8 months ago

nuxt-web-update-notification v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

nuxt-web-update-notification npm

Detect webpage updates and notify user to reload. support Nuxt.

Install

# use yarn (recommend)
yarn add -D nuxt-web-update-notification
# or use npm
npm install --save-dev nuxt-web-update-notification

Example

// nuxt.config.js
export default {
  mode: 'universal',
  env: {
    PATH_TYPE: process.env.PATH_TYPE,
  },
  /*
   ** Nuxt.js modules
   */
  modules: [
    [
      'nuxt-web-update-notification',
      {
        logVersion: true,
        checkInterval: 5 * 60 * 1000, // 5 分钟设置轮询一次
        // 在某些环境下才开启该 Module
        shouldBeEnable: (options) => {
          if (options.env.PATH_TYPE === 'trial') {
            return true;
          }
          return false;
        },
      },
    ],
  ],
};

Thanks