# refresh-helper-webpack-plugin

> A webpack plugin that reminds the user of new release to refresh page

Latest version **0.1.4** (published 2022-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install refresh-helper-webpack-plugin
pnpm add refresh-helper-webpack-plugin
yarn add refresh-helper-webpack-plugin
bun add refresh-helper-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2022-12-01 |
| First published | 2022-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 23.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | mingmingwon |
| Keywords | refresh helper |

## Links

- npm: https://www.npmjs.com/package/refresh-helper-webpack-plugin
- Repository: https://github.com/mingmingwon/refresh-helper-webpack-plugin
- Homepage: https://github.com/mingmingwon/refresh-helper-webpack-plugin#readme
- Issues: https://github.com/mingmingwon/refresh-helper-webpack-plugin/issues
- npm.io page: https://npm.io/package/refresh-helper-webpack-plugin

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.6

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2022-12-01
- 0.1.3 — 2022-11-14
- 0.1.2 — 2022-11-10
- 0.1.1 — 2022-11-08
- 0.1.0 — 2022-11-07

## README

[![npm](https://img.shields.io/npm/v/refresh-helper-webpack-plugin.svg)](https://www.npmjs.com/package/refresh-helper-webpack-plugin) [![npm](https://img.shields.io/npm/dt/refresh-helper-webpack-plugin.svg)](https://www.npmjs.com/package/refresh-helper-webpack-plugin) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/mingmingwon/refresh-helper-webpack-plugin/blob/master/LICENSE) 

# Introduction

A webpack plugin that reminds the user of new release to refresh page.

# Features

- Using `visibilitychange` API, see details at [MDN](https://developer.mozilla.org/zh-CN/docs/Web/API/Page_Visibility_API) and its [compatibility](https://caniuse.com/?search=visibilitychange). It is more in line with our expectations.
- Normal desktop pages will show refresh popup at right-bottom corner and fresh by clicking refresh button, iframe desktop pages have an `iframe` option to show refresh popup or refresh directly without any reminding by default. Mobile pages will refresh directly without any reminding. Pages visibility states embedded in iframe are the same as parent document.
- When page becomes `hidden`, cancel request if it is not completed, do nothing if request is completed. When page becomes `visible`, throttle to avoid fetching interface frequently, do nothing if refresh popup exists already.
- None dependency, none invasion, and simple compression.

# Install

[![NPM](https://nodei.co/npm/refresh-helper-webpack-plugin.png)](https://nodei.co/npm/refresh-helper-webpack-plugin/)
```
npm i refresh-helper-webpack-plugin -D
```

# Usage

Modify your `vue.config.js` like below limited in `build` script.

```js
const RefreshHelperWebpackPlugin = require('refresh-helper-webpack-plugin')

module.exports = {
  // ...
  configureWebpack: config => {
    // ...
    process.argv.includes('build') && config.plugins.push(new RefreshHelperWebpackPlugin())
    // ...
  }
  // ...
};
```

Change the `pages/message/btnText/throttle/iframe` option if needed, see default value in `Options` section.

```js
const RefreshHelperWebpackPlugin = require('refresh-helper-webpack-plugin')

module.exports = {
  // ...
  configureWebpack: config => {
    // ...
    process.argv.includes('build') && config.plugins.push(new RefreshHelperWebpackPlugin({
      pages: 'other.html', // String or Array
      message: '提示信息文本',
      btnText: '按钮文本',
      throttle: 180000, // 3 minutes
      iframe: true
    }))
    // ...
  }
  // ...
};
```
In addition, an envrionment variable named `process.env.VUE_APP_VSERION` representing the current version has been injected.

# Options

|Name|Type|Required|Default|Description|
|:--:|:--:|:-----:|:-----:|:----------|
|pages|String/Array|false|`output pages`|compiled html file name|
|message|String|false|`发现新版本啦`|new release message|
|btnText|String|false|`更新`|refresh button text|
|throttle|Number|false|`60000`|delay between two requests|
|iframe|Boolean|false|`false`|show popup or not|


# License

The MIT License

---
_Source: https://npm.io/package/refresh-helper-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
