Fix service worker tsconfig

This commit is contained in:
Tobias Berger 2021-11-03 14:38:46 +01:00
parent 0c107bc849
commit 678302640f
2 changed files with 4 additions and 4 deletions

View file

@ -5,7 +5,7 @@ const STATIC_CACHE_NAME = CACHE_NAME + "-" + CACHE_VERSION;
const INITIAL_FILES_TO_CACHE = ["/", "/index.html", "/build/bundle.js", "/build/bundle.css", "/favicon.png"]; const INITIAL_FILES_TO_CACHE = ["/", "/index.html", "/build/bundle.js", "/build/bundle.css", "/favicon.png"];
const CACHE_DENYLIST = ["/manifest.json", "/service-worker.js", "livereload.js"]; const CACHE_DENYLIST = ["/manifest.json", "/service-worker.js", "livereload.js"];
const globalScope = self as unknown /* as WorkerGlobalScope */ as ServiceWorkerGlobalScope; const globalScope = self as unknown as ServiceWorkerGlobalScope;
globalScope.addEventListener("install", (event) => { globalScope.addEventListener("install", (event) => {
console.debug("[ServiceWorker] Install"); console.debug("[ServiceWorker] Install");
@ -18,10 +18,10 @@ globalScope.addEventListener("install", (event) => {
); );
}); });
globalScope.addEventListener("activate", (evt) => { globalScope.addEventListener("activate", (event) => {
console.log("[ServiceWorker] Activate"); console.log("[ServiceWorker] Activate");
// Remove previous cached data from disk. // Remove previous cached data from disk.
evt.waitUntil( event.waitUntil(
caches.keys().then((keyList) => { caches.keys().then((keyList) => {
return Promise.all( return Promise.all(
keyList.map((key) => { keyList.map((key) => {

View file

@ -1,7 +1,7 @@
{ {
"target": "es2021",
"include": ["service-worker.ts"], "include": ["service-worker.ts"],
"compilerOptions": { "compilerOptions": {
"target": "ES2021",
"lib": ["WebWorker"] "lib": ["WebWorker"]
} }
} }