1.0.1 • Published 1 year ago

notify-update v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Notify-Update

npm version downloads README README

Notify-Update is a library for comparing local and remote application versions and notifying users when a new version is available.

Installation

npm install notify-update

Usage

import compareVersionLoop, { loopOptions } from "notify-update";
import releaseInfo from '/public/release-version.json'

const option: loopOptions = {
  version: releaseInfo.version,
  loopTime: 5 * 1000,
  remoteUrl: "/release-version.json",
};

compareVersionLoop(option);

Options

compareVersionLoop accepts the following options:

  • version: The current version of the application.
  • remoteUrl: The URL to fetch the latest version information. Defaults to "/release-version.json".
  • loopTime: The interval (in milliseconds) to check for a new version. Defaults to 2000.
  • lang: The language for the notification message. Defaults to "zh".
  • langDataObj: An object containing translated message for each language.
  • appId: A string used to identify the application. Useful when you have multiple applications on the same page.

Note

Make sure to inject the latest version interception before building, use npm script's prebuild to intercept. The interception command is "prebuild": "xxx", generate a release-version.json file, and it's recommended to use raiden-version.

"prebuild": "raiden version build --target './public'"

License

This project is released under the MIT license - see the LICENSE file for details.

1.0.1

1 year ago

1.0.0

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago