https://github.com/afeiship/react-sw-update-tips
Update tips for service-worker.
https://github.com/afeiship/react-sw-update-tips
react service-worker sw tips
Last synced: about 1 month ago
JSON representation
Update tips for service-worker.
- Host: GitHub
- URL: https://github.com/afeiship/react-sw-update-tips
- Owner: afeiship
- License: mit
- Created: 2019-07-18T00:02:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-17T12:50:13.000Z (over 4 years ago)
- Last Synced: 2025-03-11T22:23:15.524Z (2 months ago)
- Topics: react, service-worker, sw, tips
- Language: JavaScript
- Size: 445 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# react-sw-update-tips
> Update tips for service-worker.[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]## installation
```shell
npm install -S @jswork/react-sw-update-tips
```## update
```shell
npm update @jswork/react-sw-update-tips
```## properties
| Name | Type | Required | Default | Description |
| --------- | ------ | -------- | ---------------------------- | ------------------------------------- |
| className | string | false | - | The extended className for component. |
| text | union | false | '↺ 有新版本更新啦,点击刷新' | Tips text. |
| value | bool | false | false | Default value. |
| hidden | bool | false | false | The html hidden status. |
| onChange | func | false | - | The change handler. |## usage
1. import css
```scss
@import "~@jswork/react-sw-update-tips/dist/style.scss";// customize your styles:
$react-sw-update-tips-options: ()
```
2. import js
```js
import NxOfflineSw from '@jswork/next-offline-sw';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactSwUpdateTips from '@jswork/react-sw-update-tips';
import './assets/style.scss';class App extends React.Component {
state = {
hasUpdate: true
};componentDidMount() {
this.installSw();
}installSw() {
NxOfflineSw.install({
onUpdateReady: function () {
// this.setState({ hasUpdate: false });
console.log('SW Event:', 'onUpdateReady');
}
});
}render() {
return (
);
}
}ReactDOM.render(, document.getElementById('app'));
```
## documentation
- https://afeiship.github.io/react-sw-update-tips/## license
Code released under [the MIT license](https://github.com/afeiship/react-sw-update-tips/blob/master/LICENSE.txt).[version-image]: https://img.shields.io/npm/v/@jswork/react-sw-update-tips
[version-url]: https://npmjs.org/package/@jswork/react-sw-update-tips[license-image]: https://img.shields.io/npm/l/@jswork/react-sw-update-tips
[license-url]: https://github.com/afeiship/react-sw-update-tips/blob/master/LICENSE.txt[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-sw-update-tips
[size-url]: https://github.com/afeiship/react-sw-update-tips/blob/master/dist/react-sw-update-tips.min.js[download-image]: https://img.shields.io/npm/dm/@jswork/react-sw-update-tips
[download-url]: https://www.npmjs.com/package/@jswork/react-sw-update-tips