-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checking the pwa installation capabilities (#34)
* checking the pwa installation capabilities * fixing PR review comments * added better and bigger icon images * adding image files to cahce; loading pwacompact in async way * deferring the pwacompact to render the DOM first * more clean code --------- Co-authored-by: Gokul K <gokulk@Gokuls-MacBook-Air.local>
- Loading branch information
Showing
8 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import fs from "fs"; | ||
|
||
const copyFilePlugin = (fileSrcPath, fileDestPath) => ({ | ||
name: "copy-file-plugin", | ||
setup(build) { | ||
build.onEnd(async () => { | ||
try { | ||
fs.copyFileSync(fileSrcPath, fileDestPath); | ||
} catch (e) { | ||
console.error(`Failed to copy file: ${fileSrcPath}`, e); | ||
} | ||
}); | ||
}, | ||
}); | ||
|
||
export default copyFilePlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "Type to Calculate", | ||
"short_name": "Type to Calculate", | ||
|
||
"icons": [ | ||
{ | ||
"src": "/assets/images/favicon/favicon-16.png", | ||
"sizes": "16x16", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/assets/images/favicon/favicon-32.png", | ||
"sizes": "32x32", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/assets/images/favicon/favicon-48.png", | ||
"sizes": "48x48", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/assets/images/favicon/favicon-150.png", | ||
"sizes": "150x150", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/assets/images/favicon/favicon-192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "/assets/images/favicon/favicon-512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#191919", | ||
"background_color": "#7f7f7f" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// sw.js | ||
const CACHE_NAME = "ttc-cache-v1"; | ||
const urlsToCache = [ | ||
"/", | ||
"/index.html", | ||
"/css/*.css", | ||
"/js/editor.js", | ||
"/favicon-150.png", | ||
"/favicon-48.png", | ||
"/favicon-512.png", | ||
"/favicon-192.png", | ||
]; | ||
|
||
// Install the service worker | ||
self.addEventListener("install", (event) => { | ||
event.waitUntil( | ||
caches.open(CACHE_NAME).then((cache) => { | ||
return cache.addAll(urlsToCache); | ||
}) | ||
); | ||
}); | ||
|
||
// Fetch the cached assets | ||
self.addEventListener("fetch", (event) => { | ||
event.respondWith( | ||
caches.match(event.request).then((response) => { | ||
return response || fetch(event.request); | ||
}) | ||
); | ||
}); |