Я следую учебному пособию по созданию простого PWA с Angular.В этом уроке инструктор использует Angular 4.3, а я использую Angular 7.1.1.
В настоящее время я пытаюсь добавить push-уведомления.Инструктор добавил в свой файл ngsw-manifest.json раздел с названием «push».Я пытаюсь найти новый эквивалент этого для моего Angular 7 ngsw-config.json, но пока мне не повезло.Любая помощь будет принята с благодарностью!Файлы json можно найти ниже.
ngsw-manifest.json (пример инструктора)
{
"routing": {
"index": "/index.html",
"routes": {
"/": {
"match": "exact"
},
"/coffee": {
"match": "prefix"
}
}
},
"static.ignore": [
"^\/icons\/.*$"
],
"external": {
"urls": [
{
"url": "https://fonts.googleapis.com/icon?family=Material+Icons"
},
{
"url": "https://fonts.gstatic.com/s/materialicons/v22/2fcrYFNaTjcS6g4U3t-Y5UEw0lE80llgEseQY3FEmqw.woff2"
}
]
},
"dynamic": {
"group": [
{
"name": "api",
"urls": {
"http://localhost:3000/coffees": {
"match": "prefix"
}
},
"cache": {
"optimizeFor": "performance",
"networkTimeoutMs": 1000,
"maxEntries": 30,
"strategy": "lru",
"maxAgeMs": 360000000
}
}
]
},
"push": {
"showNotifications": true,
"backgroundOnly": false
}
}
ngsw-config (мой файл)
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
],
"urls": [
"https://fonts.googleapis.com/icon?family=Material+Icons",
"https://fonts.gstatic.com/s/materialicons/v41/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2"
]
}
}, {
"name": "assets",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}, {
"name": "icons",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/icons/**"
]
}
}
],
"dataGroups": [
{
"name": "posts",
"urls": [
"http://localhost:3000/coffees"
],
"cacheConfig": {
"maxSize": 20,
"maxAge": "6h",
"timeout": "15s",
"strategy": "freshness"
}
}
]
}