Add service worker to application startup

This commit is contained in:
2024-07-20 21:37:54 +09:30
parent 6e977c4cfe
commit a4f5454c7a
2 changed files with 12 additions and 0 deletions

View File

@@ -8,6 +8,11 @@
"projects": {
"proto-creator": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
@@ -20,6 +25,7 @@
"browser": "src/main.ts",
"polyfills": [],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",

View File

@@ -1,6 +1,7 @@
import {
APP_INITIALIZER,
ApplicationConfig,
isDevMode,
provideExperimentalZonelessChangeDetection,
} from '@angular/core';
import { provideRouter } from '@angular/router';
@@ -10,6 +11,7 @@ import {
MatIconRegistry,
} from '@angular/material/icon';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { provideServiceWorker } from '@angular/service-worker';
import hljs from 'highlight.js/lib/core';
import json from 'highlight.js/lib/languages/json';
import { provideMonacoEditor } from 'ngx-monaco-editor-v2';
@@ -43,5 +45,9 @@ export const appConfig: ApplicationConfig = {
useValue: { fontSet: 'material-symbols-rounded' },
},
provideMonacoEditor(),
provideServiceWorker('ngsw-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000',
}),
],
};