Skip to content

Instantly share code, notes, and snippets.

View webmaxru's full-sized avatar
😀
Progressive Web Max

Maxim Salnikov webmaxru

😀
Progressive Web Max
View GitHub Profile

Keybase proof

I hereby claim:

  • I am webmaxru on github.
  • I am salnikov (https://keybase.io/salnikov) on keybase.
  • I have a public key whose fingerprint is 5E98 E250 933E EC15 6DDF 9A47 CF7D 8C92 1A96 7D51

To claim this, I am signing this object:

importScripts('workbox-sw.prod.v2.0.0.js');
const fileManifest = [
{
"url": "index.html",
"revision": "a2153190bf7f353370efd3f79df6fd9a"
}
...
];
platformBrowserDynamic()
.bootstrapModule(AppModule)
.then(() => {
registerServiceWorker('sw-default')
});
function registerServiceWorker(swName: string) {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register(`/${swName}.js`)
module.exports = {
"globDirectory": "dist/",
"globPatterns": [
"**/*.{txt,png,ico,html,js,json,css}"
],
"swDest": "dist/sw-default.js",
"globIgnores": [
"../workbox-cli-config.js",
"3rdpartylicenses.txt"
]
@webmaxru
webmaxru / app.module.ts
Last active October 1, 2017 21:00
ngsw - registration - app.module.ts
...
import { ServiceWorkerModule } from '@angular/service-worker'
@NgModule({
imports: [
...
ServiceWorkerModule.register('/ngsw-worker.js')
]
...
@webmaxru
webmaxru / in.d.ts
Created October 2, 2017 10:30
ngsw - configuration interface
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @experimental
*/
@webmaxru
webmaxru / ngsw.json
Created October 2, 2017 14:24
ngsw - control file
{
"configVersion": 1,
"index": "/index.html",
"appData": {
"test": true
},
"assetGroups": [
{
"name": "appshell",
"installMode": "prefetch",
@webmaxru
webmaxru / ngsw-config.json
Last active October 2, 2017 14:24
ngsw - configuration file
{
"index": "/index.html",
"appData": {
"test": true
},
"assetGroups": [{
"name": "appshell",
"resources": {
"files": [
"/assets/**/*",
@webmaxru
webmaxru / app.module.ts
Created November 3, 2017 23:42
Registering Angular Service Worker
import { ServiceWorkerModule } from '@angular/service-worker'
import { environment } from '../environments/environment';
...
@NgModule({
imports: [
...
environment.production ? ServiceWorkerModule.register('/ngsw-worker.js') : []
],
@webmaxru
webmaxru / control-push.component.ts
Created November 4, 2017 12:09
Subscription to push using SwPush
import { SwPush } from '@angular/service-worker';
...
// Injecting SwPush dependency
constructor(private pushService: PushService, private swPush: SwPush) {}
subscribeToPush() {
// Requesting messaging service to subscribe current client (browser)