Skip to content

Commit aa132f0

Browse files
committed
docs: update docs
1 parent 915733d commit aa132f0

File tree

10 files changed

+69
-49
lines changed

10 files changed

+69
-49
lines changed

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ English | [简体中文](./README.zh-CN.md)
33
# plugin-web-update-notification
44

55
<p align="center">
6-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
7-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
6+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
7+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
88
</a>
99
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
1010
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -21,7 +21,7 @@ English | [简体中文](./README.zh-CN.md)
2121

2222
Detect webpage updates and notify user to reload. support vite, umijs and webpack.
2323

24-
> Take the git commit hash( if not a git repository, use packaging time) as the version number, and write version into json file. The client polls the version of the server (visibilitychange event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page.
24+
> Take the git commit hash (also support package.json version、build timestamp) as the version number, and write version into json file. The client polls the version of the server (visibilitychange or focus event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page (you can custom behavior).
2525
2626
<p align="center">
2727
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -35,7 +35,7 @@ Detect webpage updates and notify user to reload. support vite, umijs and webpac
3535
1. first load page.
3636
2. poll (default: 10 * 60 * 1000 ms).
3737
3. script resource loading failure detected (404 ?).
38-
4. when the browser is refocus or revisible.
38+
4. when the browser window is refocus or revisible.
3939

4040
## Why
4141

@@ -112,7 +112,7 @@ export default defineConfig({
112112
```
113113

114114
```ts
115-
// hidden default notification, listener to update event custom behavior.
115+
// hidden default notification, listener to update event and custom behavior.
116116
// vite.config.ts
117117
export default defineConfig({
118118
plugins: [
@@ -178,6 +178,8 @@ module.exports = defineConfig({
178178
function webUpdateNotice(options?: Options): Plugin
179179

180180
interface Options {
181+
/** default is 'git_commit_hash' */
182+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
181183
/** polling interval(ms), default 10*60*1000 */
182184
checkInterval?: number
183185
/** whether to output commit-hash in console */

README.zh-CN.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# plugin-web-update-notification
44
<p align="center">
5-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
6-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
5+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
6+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
77
</a>
88
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
99
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -19,7 +19,7 @@
1919

2020
检测网页更新并通知用户刷新,支持 vite、umijs 和 webpack 插件。
2121

22-
> 以 git commit hash ( 如果不是一个 git 仓库,使用打包时的时间戳) 为版本号,打包时将版本号写入 json 文件。客户端轮询服务器上的版本号(窗口的 visibilitychange 事件做辅助), 和本地作比较,如果不相同则通知用户刷新页面。
22+
> 以 git commit hash (也支持 package.json version、build timestamp) 为版本号,打包时将版本号写入 json 文件。客户端轮询服务器上的版本号(浏览器窗口的 visibilitychange、focus 事件辅助),和本地作比较,如果不相同则通知用户刷新页面。
2323
2424
<p align="center">
2525
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -33,7 +33,7 @@
3333
1. 首次加载页面。
3434
2. 轮询 (default: 10 * 60 * 1000 ms)。
3535
3. script 脚本资源加载失败 (404 ?)。
36-
4. when the browser is refocus or revisible。
36+
4. when the browser window is refocus or revisible。
3737

3838
## Why
3939

@@ -174,6 +174,8 @@ module.exports = defineConfig({
174174
function webUpdateNotice(options?: Options): Plugin
175175

176176
interface Options {
177+
/** default is 'git_commit_hash' */
178+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
177179
/** polling interval(ms), default 10*60*1000 */
178180
checkInterval?: number
179181
/** whether to output commit-hash in console */

packages/core/README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ English | [简体中文](./README.zh-CN.md)
33
# plugin-web-update-notification
44

55
<p align="center">
6-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
7-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
6+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
7+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
88
</a>
99
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
1010
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -21,7 +21,7 @@ English | [简体中文](./README.zh-CN.md)
2121

2222
Detect webpage updates and notify user to reload. support vite, umijs and webpack.
2323

24-
> Take the git commit hash( if not a git repository, use packaging time) as the version number, and write version into json file. The client polls the version of the server (visibilitychange event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page.
24+
> Take the git commit hash (also support package.json version、build timestamp) as the version number, and write version into json file. The client polls the version of the server (visibilitychange or focus event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page (you can custom behavior).
2525
2626
<p align="center">
2727
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -35,7 +35,7 @@ Detect webpage updates and notify user to reload. support vite, umijs and webpac
3535
1. first load page.
3636
2. poll (default: 10 * 60 * 1000 ms).
3737
3. script resource loading failure detected (404 ?).
38-
4. when the browser is refocus or revisible.
38+
4. when the browser window is refocus or revisible.
3939

4040
## Why
4141

@@ -112,7 +112,7 @@ export default defineConfig({
112112
```
113113

114114
```ts
115-
// hidden default notification, listener to update event custom behavior.
115+
// hidden default notification, listener to update event and custom behavior.
116116
// vite.config.ts
117117
export default defineConfig({
118118
plugins: [
@@ -178,6 +178,8 @@ module.exports = defineConfig({
178178
function webUpdateNotice(options?: Options): Plugin
179179

180180
interface Options {
181+
/** default is 'git_commit_hash' */
182+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
181183
/** polling interval(ms), default 10*60*1000 */
182184
checkInterval?: number
183185
/** whether to output commit-hash in console */

packages/core/README.zh-CN.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ English | [简体中文](./README.zh-CN.md)
33
# plugin-web-update-notification
44

55
<p align="center">
6-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
7-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
6+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
7+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
88
</a>
99
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
1010
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -21,7 +21,7 @@ English | [简体中文](./README.zh-CN.md)
2121

2222
Detect webpage updates and notify user to reload. support vite, umijs and webpack.
2323

24-
> Take the git commit hash( if not a git repository, use packaging time) as the version number, and write version into json file. The client polls the version of the server (visibilitychange event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page.
24+
> Take the git commit hash (also support package.json version、build timestamp) as the version number, and write version into json file. The client polls the version of the server (visibilitychange or focus event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page (you can custom behavior).
2525
2626
<p align="center">
2727
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -35,7 +35,7 @@ Detect webpage updates and notify user to reload. support vite, umijs and webpac
3535
1. first load page.
3636
2. poll (default: 10 * 60 * 1000 ms).
3737
3. script resource loading failure detected (404 ?).
38-
4. when the browser is refocus or revisible.
38+
4. when the browser window is refocus or revisible.
3939

4040
## Why
4141

@@ -112,7 +112,7 @@ export default defineConfig({
112112
```
113113

114114
```ts
115-
// hidden default notification, listener to update event custom behavior.
115+
// hidden default notification, listener to update event and custom behavior.
116116
// vite.config.ts
117117
export default defineConfig({
118118
plugins: [
@@ -178,6 +178,8 @@ module.exports = defineConfig({
178178
function webUpdateNotice(options?: Options): Plugin
179179

180180
interface Options {
181+
/** default is 'git_commit_hash' */
182+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
181183
/** polling interval(ms), default 10*60*1000 */
182184
checkInterval?: number
183185
/** whether to output commit-hash in console */

packages/umi-plugin/README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ English | [简体中文](./README.zh-CN.md)
33
# plugin-web-update-notification
44

55
<p align="center">
6-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
7-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
6+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
7+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
88
</a>
99
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
1010
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -21,7 +21,7 @@ English | [简体中文](./README.zh-CN.md)
2121

2222
Detect webpage updates and notify user to reload. support vite, umijs and webpack.
2323

24-
> Take the git commit hash( if not a git repository, use packaging time) as the version number, and write version into json file. The client polls the version of the server (visibilitychange event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page.
24+
> Take the git commit hash (also support package.json version、build timestamp) as the version number, and write version into json file. The client polls the version of the server (visibilitychange or focus event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page (you can custom behavior).
2525
2626
<p align="center">
2727
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -35,7 +35,7 @@ Detect webpage updates and notify user to reload. support vite, umijs and webpac
3535
1. first load page.
3636
2. poll (default: 10 * 60 * 1000 ms).
3737
3. script resource loading failure detected (404 ?).
38-
4. when the browser is refocus or revisible.
38+
4. when the browser window is refocus or revisible.
3939

4040
## Why
4141

@@ -112,7 +112,7 @@ export default defineConfig({
112112
```
113113

114114
```ts
115-
// hidden default notification, listener to update event custom behavior.
115+
// hidden default notification, listener to update event and custom behavior.
116116
// vite.config.ts
117117
export default defineConfig({
118118
plugins: [
@@ -178,6 +178,8 @@ module.exports = defineConfig({
178178
function webUpdateNotice(options?: Options): Plugin
179179

180180
interface Options {
181+
/** default is 'git_commit_hash' */
182+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
181183
/** polling interval(ms), default 10*60*1000 */
182184
checkInterval?: number
183185
/** whether to output commit-hash in console */

packages/umi-plugin/README.zh-CN.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ English | [简体中文](./README.zh-CN.md)
33
# plugin-web-update-notification
44

55
<p align="center">
6-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
7-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
6+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
7+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
88
</a>
99
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
1010
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -21,7 +21,7 @@ English | [简体中文](./README.zh-CN.md)
2121

2222
Detect webpage updates and notify user to reload. support vite, umijs and webpack.
2323

24-
> Take the git commit hash( if not a git repository, use packaging time) as the version number, and write version into json file. The client polls the version of the server (visibilitychange event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page.
24+
> Take the git commit hash (also support package.json version、build timestamp) as the version number, and write version into json file. The client polls the version of the server (visibilitychange or focus event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page (you can custom behavior).
2525
2626
<p align="center">
2727
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -35,7 +35,7 @@ Detect webpage updates and notify user to reload. support vite, umijs and webpac
3535
1. first load page.
3636
2. poll (default: 10 * 60 * 1000 ms).
3737
3. script resource loading failure detected (404 ?).
38-
4. when the browser is refocus or revisible.
38+
4. when the browser window is refocus or revisible.
3939

4040
## Why
4141

@@ -112,7 +112,7 @@ export default defineConfig({
112112
```
113113

114114
```ts
115-
// hidden default notification, listener to update event custom behavior.
115+
// hidden default notification, listener to update event and custom behavior.
116116
// vite.config.ts
117117
export default defineConfig({
118118
plugins: [
@@ -178,6 +178,8 @@ module.exports = defineConfig({
178178
function webUpdateNotice(options?: Options): Plugin
179179

180180
interface Options {
181+
/** default is 'git_commit_hash' */
182+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
181183
/** polling interval(ms), default 10*60*1000 */
182184
checkInterval?: number
183185
/** whether to output commit-hash in console */

packages/vite-plugin/README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ English | [简体中文](./README.zh-CN.md)
33
# plugin-web-update-notification
44

55
<p align="center">
6-
<a href="https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js">
7-
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core@0.3.0/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
6+
<a href="https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js">
7+
<img src="https://img.badgesize.io/https://unpkg.com/@plugin-web-update-notification/core/dist/webUpdateNoticeInjectScript.js?compression=gzip&style=flat-square" alt="Gzip Size" />
88
</a>
99
<a href="https://www.npmjs.com/package/@plugin-web-update-notification/core">
1010
<img src="https://img.shields.io/npm/v/@plugin-web-update-notification/core.svg?style=flat-square&colorB=51C838" alt="NPM Version" />
@@ -21,7 +21,7 @@ English | [简体中文](./README.zh-CN.md)
2121

2222
Detect webpage updates and notify user to reload. support vite, umijs and webpack.
2323

24-
> Take the git commit hash( if not a git repository, use packaging time) as the version number, and write version into json file. The client polls the version of the server (visibilitychange event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page.
24+
> Take the git commit hash (also support package.json version、build timestamp) as the version number, and write version into json file. The client polls the version of the server (visibilitychange or focus event assistant), compares it with the local one, and if it is not the same, notifies the user to refresh the page (you can custom behavior).
2525
2626
<p align="center">
2727
<img width="180" src="https://raw.githubusercontent.com/GreatAuk/plugin-web-update-notification/master/images/vue_example.webp">
@@ -35,7 +35,7 @@ Detect webpage updates and notify user to reload. support vite, umijs and webpac
3535
1. first load page.
3636
2. poll (default: 10 * 60 * 1000 ms).
3737
3. script resource loading failure detected (404 ?).
38-
4. when the browser is refocus or revisible.
38+
4. when the browser window is refocus or revisible.
3939

4040
## Why
4141

@@ -112,7 +112,7 @@ export default defineConfig({
112112
```
113113

114114
```ts
115-
// hidden default notification, listener to update event custom behavior.
115+
// hidden default notification, listener to update event and custom behavior.
116116
// vite.config.ts
117117
export default defineConfig({
118118
plugins: [
@@ -178,6 +178,8 @@ module.exports = defineConfig({
178178
function webUpdateNotice(options?: Options): Plugin
179179

180180
interface Options {
181+
/** default is 'git_commit_hash' */
182+
versionType?: 'git_commit_hash' | 'pkg_version' | 'build_timestamp'
181183
/** polling interval(ms), default 10*60*1000 */
182184
checkInterval?: number
183185
/** whether to output commit-hash in console */

0 commit comments

Comments
 (0)