Comments (1)
The service worker lifecycle is complex, we may have 2 service workers when new version detected.
Here is what I understand so far, and some related questions.
* isInstalled: true when PWA is installed on the device.
PWA installed, also TWA, but not all cases, check link in the template
* showInstallPrompt: _This seems to be a state, but what is impacting its value?
this flag is to call browser/native prompt: check https://elk.zone app on browser, right aside (next popup will be shown only when this flag is true)
* cancelInstall: _What does this method?_
this method only force to remove the custom install popup, it is the dismiss
button in previous screenshot: once cancelInstall
called showInstallPrompt
will never be true again (will store false in local storage), sometimes ppl just want browser/native install behavior
if installation cancelled from browser/install prompt, showInstallPrompt
will be activated when required
* install: Install the PWA. _What if called while already installed?_
nothing happens, the method is just Promise.resolve()
: the plugin will change it when received beforeinstallprompt
event
calling this method will just call browser/native install logic
* swActivated: state of the activation of the service worker.
will be true when the new/current sw is active: check the logic in the template, onRegisteredSW
callback
* registrationError: indicate if an error occurred during SW registration. _How to get the error?_
not exposed: we can expose it in onRegistrationError
(I need to check if we can access it from active sw)
* offlineReady: _What does it mean exactly? What is impacting its value?_
flag only fired in first sw install: you can use it to show your app is ready to work offline
when using workbox precaching
* needRefresh: _What does it mean exactly? What is impacting its value?
this flag will be true when new sw detected and ready to be activated: only when using prompt
register type
* updateServiceWorker: Method to update SW when an update is pending. _Is it related to needRefresh?
yes, once needRefresh
is true, the UI should bind button click to this method to activate the new service worker (will claim all openened clients, tabs and browser instances, controlled by previous installed service worker)
* cancelPrompt: _What does this method? Is it related to cancelInstall?_
no, it is related to offlineReady
and needRefresh
: when new sw detected, the ui should show a prompt, this method will switch these 2 flags to false
* getSWRegistration: Get the SW registration.
from nuxt.
Related Issues (20)
- Importing the virtual module in a unit test with Vitest HOT 2
- npm WARN when run "npm i @vite-pwa/nuxt -D" HOT 3
- [Feature Request]: dynamic manifest.json via nitro HOT 2
- pwa does not cache data in Nuxt 3 SSR HOT 3
- Firefox injectManifest not working HOT 1
- Cannot find module '#pwa' or its corresponding type declarations. HOT 2
- vite-pwa/nuxt not working on ios
- Module does nothing ? (EDIT: No Firefox support ?) HOT 9
- Nuxt3 + PWA warnings in terminal HOT 6
- cant use npm run build
- I can't get 'start_url' to work for me
- showInstallPrompt not being called HOT 1
- Uncaught ReferenceError: __NUXT_ASYNC_CONTEXT__ is not defined HOT 7
- Service Worker "import sentry-release-injection" error when loading page HOT 19
- @vite-pwa/nuxt and vue-tsc conflict HOT 4
- API Request URLs Open in New Tab Redirect to 404 Page HOT 2
- Generate PWA Assets functionality not works when srcDir is not default HOT 15
- Default value of navigateFallbackAllowlist
- offline mode: when I navigate to another route, it shows nothing, but when I refresh then it shows the page from cache HOT 7
- Vite-pwa/nuxt not caching pages on a client-side rendered app HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.