sw-precache

How: ServiceWorker check if ready to update

流过昼夜 提交于 2020-01-13 07:33:17
问题 What I am trying to achieve: render page with loader/spinner if service-worker.js is registered and active, then check for updates if no updates, then remove loader if updatefound and new version installed, then reload the page else register service-worker.js when updatefound , meaning new one was installed, remove loader I am using sw-precache module for me to generate service-worker.js and following registration code: window.addEventListener('load', function() { // show loader addLoader();

“New version available” with service worker and sw-precache

喜你入骨 提交于 2019-12-19 02:03:34
问题 I'm trying to use sw-precache , but I must be doing something wrong! I'm mostly using the demo code available from the github repo and can't seem to get updates to the app to come through. Once it's cached the first time, it never checks for new versions. I was expecting that when I publish a new service worker, the browser would request the new service worker and update the cache accordingly in the background. Then using the registration code in the example, I would be able to prompt the

“New version available” with service worker and sw-precache

孤人 提交于 2019-12-19 02:03:29
问题 I'm trying to use sw-precache , but I must be doing something wrong! I'm mostly using the demo code available from the github repo and can't seem to get updates to the app to come through. Once it's cached the first time, it never checks for new versions. I was expecting that when I publish a new service worker, the browser would request the new service worker and update the cache accordingly in the background. Then using the registration code in the example, I would be able to prompt the

Service workers on cordova app

六眼飞鱼酱① 提交于 2019-12-13 11:45:06
问题 Can i use service workers inside hybrids apps(ionic 1/cordova) running on android devices? I'm getting some errors when trying to install a service worker on ionic app running on android device, because android uses file protocol to serve files and service-workers require files to be served by HTTPS protocol or http(only for localhost): Error during service worker registration: DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin ('file://') is not

Configure the sw-precache WebPack plugin to load a server rendered page as the navigateFallback route

大憨熊 提交于 2019-12-12 03:48:12
问题 consider the following scenario: My express server dynamically generates HTML for the "/" route of my single page application. I would like to re-serve this same generated HTML as the service worker navigateFallback when the user is offline. I'm using https://www.npmjs.com/package/sw-precache-webpack-plugin in my webpack configuration. If I generate an index.html via html-webpack-plugin, say, and set index.html as my navigateFallback file, that generated file gets served correctly by the

sw-precache not updating and taking only cached data

∥☆過路亽.° 提交于 2019-12-11 04:29:00
问题 Iam trying to implement networkfirst strategy using sw-precache . Now iam able to cache the data and able to serve from offline . If i change the data (i.e: changed the header from 'hello' to 'Welcome') in page not get reflecting it always taking the data from the cache its getting update only if i unregistered the service worker or clear the site data then only i can get my data Here is my sw-precache gulp task : gulp.task('generate-service-worker', function(callback) { var path = require(

Service Worker skipWaiting unable to activate currently waiting SW

て烟熏妆下的殇ゞ 提交于 2019-12-10 17:46:42
问题 Description: We are using sw precache for caching the scripts before hand, hence to update the scripts we are giving reload option, for that we are listening the worker message to skip waiting the newly install service worker for unknown reason we are not getting correct importScript // GETTING OLD SW reference (self) and NOT getting newly installed SW reference self.addEventListener('message', function(event) { *// not working* self.skipWaiting(); }); // But if we put skipWaiting() in

Long time waiting Request to Service Worker

南楼画角 提交于 2019-12-08 16:04:54
问题 I have noticed that the time waiting for service workers to respond with items from the cache is not as fast as you would expect it to be. I have seen the same wait times with both sw-precache and a custom written service worker. What are the possible causes for this wait time time and how could I reduce it? My fetch event on the custom service worker looks like: self.addEventListener('fetch', function(event) { event.respondWith( caches.match(event.request).then(function(response) { if

How to remove a service worker registered in previous deploy from users' browsers with the newly deployed version of site (Firebase)?

≡放荡痞女 提交于 2019-12-06 09:43:33
问题 I've deployed a new version of my site (It was on Polymer, now on Vue.js) to Firebase over an existing project. I'm using default Vue.js template with Webpack ( vue init webpack my-project ) in the new project Now that I've deployed the new version, when I open the site I see just a cached shell, I assume that's the service worker's fault In order to get actual current files from Firebase I (and all the previous visitors) have to now hard refresh the site every time ( Ctrl+F5 in firefox)

Using sw-precache with client-side URL routes for a single page app

♀尐吖头ヾ 提交于 2019-12-05 01:32:54
问题 How would one configure sw-precache to serve index.html for multiple dynamic routes? This is for an Angular app that has index.html as the entry point. The current setup allows the app to be accessable offline only through / . So if a user go to /articles/list/popular as an entry point while offline they won't be able to browse it and would be given you're offline message. (although when online they'd be served the same index.html file on all requests as an entry point) Can