mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Add PWA support.
This commit is contained in:
		
							parent
							
								
									e229c714ed
								
							
						
					
					
						commit
						5e76940c39
					
				
					 20 changed files with 408 additions and 25 deletions
				
			
		
							
								
								
									
										34
									
								
								src/main.js
									
										
									
									
									
								
							
							
						
						
									
										34
									
								
								src/main.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,16 +1,18 @@
 | 
			
		|||
import { createApp } from 'vue'
 | 
			
		||||
import { library } from '@fortawesome/fontawesome-svg-core'
 | 
			
		||||
import { faThumbsUp, faThumbsDown, faEye } from '@fortawesome/free-solid-svg-icons'
 | 
			
		||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
 | 
			
		||||
library.add(faThumbsUp, faThumbsDown, faEye)
 | 
			
		||||
 | 
			
		||||
require("uikit/src/less/uikit.less")
 | 
			
		||||
require("uikit/dist/js/uikit.min.js")
 | 
			
		||||
 | 
			
		||||
import router from '@/router/router'
 | 
			
		||||
import App from './App.vue'
 | 
			
		||||
 | 
			
		||||
const app = createApp(App)
 | 
			
		||||
app.use(router)
 | 
			
		||||
app.component('font-awesome-icon', FontAwesomeIcon)
 | 
			
		||||
app.mount('#app')
 | 
			
		||||
import { createApp } from 'vue'
 | 
			
		||||
import { library } from '@fortawesome/fontawesome-svg-core'
 | 
			
		||||
import { faThumbsUp, faThumbsDown, faEye } from '@fortawesome/free-solid-svg-icons'
 | 
			
		||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
 | 
			
		||||
library.add(faThumbsUp, faThumbsDown, faEye)
 | 
			
		||||
 | 
			
		||||
require("uikit/src/less/uikit.less")
 | 
			
		||||
require("uikit/dist/js/uikit.min.js")
 | 
			
		||||
 | 
			
		||||
import router from '@/router/router'
 | 
			
		||||
import App from './App.vue'
 | 
			
		||||
 | 
			
		||||
import './registerServiceWorker'
 | 
			
		||||
 | 
			
		||||
const app = createApp(App)
 | 
			
		||||
app.use(router)
 | 
			
		||||
app.component('font-awesome-icon', FontAwesomeIcon)
 | 
			
		||||
app.mount('#app')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										32
									
								
								src/registerServiceWorker.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/registerServiceWorker.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
/* eslint-disable no-console */
 | 
			
		||||
 | 
			
		||||
import { register } from 'register-service-worker'
 | 
			
		||||
 | 
			
		||||
if (process.env.NODE_ENV === 'production') {
 | 
			
		||||
  register(`${process.env.BASE_URL}service-worker.js`, {
 | 
			
		||||
    ready () {
 | 
			
		||||
      console.log(
 | 
			
		||||
        'App is being served from cache by a service worker.\n' +
 | 
			
		||||
        'For more details, visit https://goo.gl/AFskqB'
 | 
			
		||||
      )
 | 
			
		||||
    },
 | 
			
		||||
    registered () {
 | 
			
		||||
      console.log('Service worker has been registered.')
 | 
			
		||||
    },
 | 
			
		||||
    cached () {
 | 
			
		||||
      console.log('Content has been cached for offline use.')
 | 
			
		||||
    },
 | 
			
		||||
    updatefound () {
 | 
			
		||||
      console.log('New content is downloading.')
 | 
			
		||||
    },
 | 
			
		||||
    updated () {
 | 
			
		||||
      console.log('New content is available; please refresh.')
 | 
			
		||||
    },
 | 
			
		||||
    offline () {
 | 
			
		||||
      console.log('No internet connection found. App is running in offline mode.')
 | 
			
		||||
    },
 | 
			
		||||
    error (error) {
 | 
			
		||||
      console.error('Error during service worker registration:', error)
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue