angular-service-worker

Angular 6 PWA with Node not working

試著忘記壹切 提交于 2019-12-02 07:19:44
I have a Angular 6 app that works and registers the SW when served with http-server --port 8080 command as you can see here: But when I serve the files from my Node / Express application that they are meant to be served. The service worker won't register, tried running the app from localhost and also from Heroku but it's the same. Application works otherwise. Any idea what can cause this? I think this issue is to do with the path that @angular/cli uses when registering the service worker, I have found registering the service worker in main.ts to be more reliable: platformBrowserDynamic()

Angular6 Service Worker and background sync

☆樱花仙子☆ 提交于 2019-11-30 21:06:52
it seems that angular6 does not support background syncing with service worker. What are the steps required to do this without any library in an angular service? https://developers.google.com/web/updates/2015/12/background-sync How and where can I access WorkerGlobalScope in an angular6 application directly so that background sync can be done.: self.addEventListener('sync', function(event) { if (event.tag == 'myFirstSync') { event.waitUntil(doSomeStuff()); } }); The problem is that the angular CLI generates the servicworker file ( ngsw-worker.js ). Is there a way to inject / modify / extend

Caching of index.html in Angular Service worker

▼魔方 西西 提交于 2019-11-30 20:24:19
Everytime I make any change to the index.html with my angular project, Serviceworker never gets updated and always serves the old cached version on index.html. How do I fix this (Also, there is no caching at the server end as well as browser) Here is my ngsw-config file { "index": "/index.html", "assetGroups": [{ "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html", "/manifest.json" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files":

Angular 5 and Service Worker: How to exclude a particular path from ngsw-config.json

时光总嘲笑我的痴心妄想 提交于 2019-11-28 00:41:40
I have ngsw-config.json (taken from the docs ): { "index": "/index.html", "assetGroups": [{ "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**" ] } }] } On my site there is a link to the RSS feed /api/rss , which should open in a new browser tab without loading Angular app. How can I exclude it from a list of resources whose request is redirected to index.html ? UPD

Tying to update PWA: swUpdate.isEnabled is true but not calling the subscribed method even when ngsw-config.json is altered

北慕城南 提交于 2019-11-26 23:44:02
问题 services/pwa.service.ts: import { Injectable } from '@angular/core'; import { SwUpdate } from '@angular/service-worker'; import {Observable} from "rxjs/Observable"; import "rxjs/add/observable/interval"; @Injectable() export class PwaService { public promptEvent: any; constructor(private swUpdate: SwUpdate) { alert('swUpdate isEnabled:' + swUpdate.isEnabled);// => alerts true if (swUpdate.isEnabled) { Observable.interval(10) .subscribe(() => swUpdate.checkForUpdate().then(() => alert(

Angular 5 and Service Worker: How to exclude a particular path from ngsw-config.json

谁说我不能喝 提交于 2019-11-26 21:46:11
问题 I have ngsw-config.json (taken from the docs): { "index": "/index.html", "assetGroups": [{ "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk.js" ] } }, { "name": "assets", "installMode": "lazy", "updateMode": "prefetch", "resources": { "files": [ "/assets/**" ] } }] } On my site there is a link to the RSS feed /api/rss , which should open in a new browser tab without loading