Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pwa 세팅작업 진행 #30

Merged
merged 3 commits into from
Oct 18, 2024
Merged
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
20 changes: 18 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="public/icons/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>Wish-위시</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script>
if ('serviceWorker' in navigator) {
// Register a service worker hosted at the root of the
// site using the default scope.
navigator.serviceWorker
.register('/sw.js')
.then((registration) => {
console.log('Service worker registration succeeded:', registration);
})
.catch((err) => {
console.log('Service worker registration failed:', error);
});
} else {
console.log('Service workers are not supported.');
}
</script>
</body>
</html>
Binary file added public/icons/favicon.ico
Binary file not shown.
Binary file added public/icons/logo-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "WishWebApplication",
"short_name": "Wish",
"start_url": "/",
"display": "standalone",
"background_color": "#ccb2ff",
"theme_color": "#eee5ff",
"description": "PWA with Wish ",
"icons": [
{
"src": "icons/logo-512x512.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "any maskable"
},
{
"src": "icons/favicon.ico",
"type": "image/png",
"sizes": "64x64 32x32 24x24 16x16",
"purpose": "any maskable"
}
]
}
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

16 changes: 16 additions & 0 deletions sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// sw.js

// install event
self.addEventListener("install", (e) => {
console.log("[Service Worker] installed");
});

// activate event
self.addEventListener("activate", (e) => {
console.log("[Service Worker] actived", e);
});

// fetch event
self.addEventListener("fetch", (e) => {
console.log("[Service Worker] fetched resource " + e.request.url);
});