Files
Joey Perrott c4b880a025 refactor: migrate docs, examples, private, service worker and upgrade to prettier formatting (#54163)
Migrate formatting to prettier for docs, examples, private, service worker and upgrade from clang-format

PR Close #54163
2024-01-30 20:08:40 +00:00

42 lines
1.2 KiB
TypeScript

/**
* @license
* Copyright Google LLC 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
*/
// tslint:disable: no-duplicate-imports
import {Component} from '@angular/core';
// #docregion registration-options
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {ServiceWorkerModule, SwRegistrationOptions} from '@angular/service-worker';
// #enddocregion registration-options
import {SwUpdate} from '@angular/service-worker';
// tslint:enable: no-duplicate-imports
@Component({
selector: 'example-app',
template: 'SW enabled: {{ swu.isEnabled }}',
})
export class AppComponent {
constructor(readonly swu: SwUpdate) {}
}
// #docregion registration-options
@NgModule({
// #enddocregion registration-options
bootstrap: [AppComponent],
declarations: [AppComponent],
// #docregion registration-options
imports: [BrowserModule, ServiceWorkerModule.register('ngsw-worker.js')],
providers: [
{
provide: SwRegistrationOptions,
useFactory: () => ({enabled: location.search.includes('sw=true')}),
},
],
})
export class AppModule {}
// #enddocregion registration-options