12345678910111213141516171819202122 |
- import { register } from 'register-service-worker';
- import { EventBus } from 'base-core-lib';
- if (process.env.NODE_ENV === 'production') {
- register(`${process.env.BASE_URL}service-worker.js`, {
- ready () {
- // EventBus.$emit('info', 'ready')
- },
- cached () {
- // EventBus.$emit('info', 'Content has been cached for offline use.')
- },
- updated () {
- EventBus.$emit('updatedSystem', '系统版本已变更,CTRL+F5刷新体验吧~', '更新提醒', 0)
- // EventBus.$emit('updatedSystem')
- },
- offline () {
- // EventBus.$emit('info', 'No internet connection found. App is running in offline mode.')
- },
- error (error) {
- // EventBus.$emit('info', 'Error during service worker registration:' + error)
- },
- });
- }
|