Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"build": "ng build --target=development --env=dev",
"build-prod": "ng build --target=production --env=prod",
"build-prod-with-source-maps": "ng build --target=production --env=prod -sm",
"ngsw-config": "ngsw-config dist src/ngsw-config.json",
"start": "ng serve --target=development --env=dev",
"start-sw": "http-server dist/ -p 4200 -o",
"start-prod": "ng serve --target=production --env=prod",
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {NavService} from './nav.service';
import {GoogleAnalyticsService} from './google-analytics.service';
import {isPlatformBrowser} from '@angular/common';
import {filter} from 'rxjs/operators';
import {Observable} from 'rxjs/Observable';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to this file can be reverted?


@Component({
selector: 'app-root',
Expand Down Expand Up @@ -64,6 +65,7 @@ export class AppComponent implements OnInit, AfterViewInit {
this.navService.appDrawer = this.appDrawer;
}


logout() {
this.navService.closeNav();
this.usersService.logout();
Expand Down
3 changes: 2 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ import {PageNotFoundComponent} from './page-not-found/page-not-found.component';
MatRippleModule,
FlexLayoutModule,
AppRoutingModule,
ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production})
ServiceWorkerModule.register('/ngsw-worker.js', {enabled: environment.production,
registrationStrategy: environment.serviceWorkerStrategy})
],
providers: [
ApiService,
Expand Down
16 changes: 15 additions & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
// For deployment to production only.
import {Observable} from 'rxjs/Observable';

export function getServiceWorkerObservable() {
return new Observable(observer => {
setTimeout(() => {
observer.next();
}, 10000);
});
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it would be a better example to move this into a file like src/app/custom-registration-strategy.ts.


export const environment = {
production: true,
firebaseConfig: {
Expand All @@ -10,5 +20,9 @@ export const environment = {
messagingSenderId: '1003263481418'
},
googleAnalyticsTrackingId: '',
mapsApiKey: 'AIzaSyCG5P0ZrbWcC212QZsEebyyGwj2KRgs700'
mapsApiKey: 'AIzaSyCG5P0ZrbWcC212QZsEebyyGwj2KRgs700',
serviceWorkerStrategy: 'registerDelay:5000'
// serviceWorkerStrategy: 'registerImmediately'
// serviceWorkerStrategy: 'registerWhenStable'
// serviceWorkerStrategy: getServiceWorkerObservable
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to see these commented out examples of using different strategies in the app.module.ts.

};
3 changes: 2 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export const environment = {
messagingSenderId: '1003263481418'
},
googleAnalyticsTrackingId: '',
mapsApiKey: 'AIzaSyCG5P0ZrbWcC212QZsEebyyGwj2KRgs700'
mapsApiKey: 'AIzaSyCG5P0ZrbWcC212QZsEebyyGwj2KRgs700',
serviceWorkerStrategy: 'registerImmediately'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably isn't needed as it will have enabled: false in this case and the strategy won't be considered.

};