diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-24 12:29:24 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-10-24 12:29:24 +0900 |
| commit | a71727538f65ab4f10f5239550be82590f9d47d1 (patch) | |
| tree | 4608d37faead4f253c3311982a400a8fb88fba9e /src/components/PwaRegister.astro | |
| parent | c7efe674b34a2949b76d62bb71a972427965af92 (diff) | |
parks: 公園一覧と地図、公共施設の情報を更新
- 近隣公園のクリックを市内公園と同じ挙動にし、Googleマップを公園名で開く
- 公共施設のトイレを○にし、ルネこだいらを追加
- 未取得だった施設の座標を追加し、再ジオコーディング時の上書きを防止
- 手入力ポリゴン、近隣公園、PWA、ライセンス表示を追加
Diffstat (limited to 'src/components/PwaRegister.astro')
| -rw-r--r-- | src/components/PwaRegister.astro | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/components/PwaRegister.astro b/src/components/PwaRegister.astro new file mode 100644 index 0000000..82359a4 --- /dev/null +++ b/src/components/PwaRegister.astro @@ -0,0 +1,19 @@ +<script> + if ("serviceWorker" in navigator) { + if (import.meta.env.PROD) { + window.addEventListener("load", () => { + navigator.serviceWorker.register("/sw.js").catch(() => { + // PWA登録に失敗しても、通常のWebページとして動作させる。 + }); + }); + } else { + // 開発時はService WorkerのキャッシュがHMRを妨げるため、既存の登録を解除する。 + navigator.serviceWorker.getRegistrations().then((registrations) => { + registrations.forEach((registration) => registration.unregister()); + }); + if ("caches" in window) { + caches.keys().then((keys) => keys.forEach((key) => caches.delete(key))); + } + } + } +</script> |
