Compare commits
No commits in common. "main" and "map" have entirely different histories.
|
|
@ -1,6 +1,6 @@
|
|||
# International Space Station Position SPA 🛰
|
||||
|
||||
[](https://rzmk.github.io/iss-position-spa)
|
||||
[](https://rzmk.github.io/iss-position-spa)
|
||||
|
||||
Fetches the latitude and longitude of the International Space Station (ISS) every 2 seconds and displays the live position on a map with a progress bar.
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 15 MiB After Width: | Height: | Size: 15 MiB |
2400
package-lock.json
generated
14
package.json
|
|
@ -13,19 +13,7 @@
|
|||
"react-icons": "^4.3.1",
|
||||
"react-scripts": "5.0.0",
|
||||
"react-simple-maps": "^2.3.0",
|
||||
"web-vitals": "^2.1.2",
|
||||
"workbox-background-sync": "^5.1.4",
|
||||
"workbox-broadcast-update": "^5.1.4",
|
||||
"workbox-cacheable-response": "^5.1.4",
|
||||
"workbox-core": "^5.1.4",
|
||||
"workbox-expiration": "^5.1.4",
|
||||
"workbox-google-analytics": "^5.1.4",
|
||||
"workbox-navigation-preload": "^5.1.4",
|
||||
"workbox-precaching": "^5.1.4",
|
||||
"workbox-range-requests": "^5.1.4",
|
||||
"workbox-routing": "^5.1.4",
|
||||
"workbox-strategies": "^5.1.4",
|
||||
"workbox-streams": "^5.1.4"
|
||||
"web-vitals": "^2.1.2"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#2b5797</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
|
@ -7,41 +7,13 @@
|
|||
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🚀</text></svg>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<!-- Primary Meta Tags -->
|
||||
<title>ISS 🛰 Latitude & Longitude! 🌎</title>
|
||||
<meta name="title" content="ISS 🛰 Latitude & Longitude! 🌎">
|
||||
<meta name="description"
|
||||
content="Live International Space Station (ISS) location data. Find out where the ISS is on a world map!">
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="https://rzmk.github.io/iss-position-spa/">
|
||||
<meta property="og:title" content="ISS 🛰 Latitude & Longitude! 🌎">
|
||||
<meta property="og:description"
|
||||
content="Live International Space Station (ISS) location data. Find out where the ISS is on a world map!">
|
||||
<meta property="og:image" content="https://i.imgur.com/VPc9O5Y.png">
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:url" content="https://rzmk.github.io/iss-position-spa/">
|
||||
<meta property="twitter:title" content="ISS 🛰 Latitude & Longitude! 🌎">
|
||||
<meta property="twitter:description"
|
||||
content="Live International Space Station (ISS) location data. Find out where the ISS is on a world map!">
|
||||
<meta property="twitter:image" content="https://i.imgur.com/VPc9O5Y.png">
|
||||
|
||||
<!-- PWA -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<meta name="description" content="Web site created using create-react-app" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#2b5797">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
|
|
|
|||
|
|
@ -1,55 +1,8 @@
|
|||
{
|
||||
"short_name": "ISS Position",
|
||||
"name": "ISS Position SPA",
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#5bbad5",
|
||||
"background_color": "#ffffff",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/favicon-16x16.png",
|
||||
"sizes": "16x16",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon-32x32.png",
|
||||
"sizes": "32x32",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "mstile-70x70.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "mstile-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "mstile-150x150.png",
|
||||
"sizes": "270x270",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "mstile-310x150.png",
|
||||
"sizes": "558x270",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "mstile-310x310.png",
|
||||
"sizes": "558x558",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
|
@ -1,252 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="700.000000pt" height="700.000000pt" viewBox="0 0 700.000000 700.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,700.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M828 6172 c-651 -650 -828 -832 -828 -852 0 -19 65 -89 283 -307 243
|
||||
-244 287 -283 312 -283 25 0 55 25 191 161 l161 161 22 -35 c12 -20 27 -38 34
|
||||
-40 7 -3 -59 -76 -145 -164 -187 -189 -186 -185 -101 -274 l56 -59 -125 0
|
||||
c-173 0 -224 -20 -275 -108 -22 -37 -28 -60 -28 -108 0 -84 39 -147 114 -186
|
||||
l53 -28 282 0 281 0 -50 -24 c-121 -57 -166 -174 -111 -292 25 -54 65 -89 125
|
||||
-110 31 -11 0 -13 -227 -14 -312 0 -337 -5 -403 -70 -118 -118 -73 -298 89
|
||||
-356 35 -12 31 -13 -73 -14 -142 0 -179 -11 -236 -69 -38 -37 -49 -57 -58
|
||||
-101 -20 -98 26 -197 112 -239 41 -20 60 -21 328 -22 l284 0 -51 -23 c-116
|
||||
-53 -163 -178 -110 -291 28 -60 46 -77 111 -107 l50 -23 -130 -5 c-106 -4
|
||||
-136 -9 -164 -25 -52 -31 -90 -84 -102 -145 -16 -74 0 -129 53 -186 69 -74 64
|
||||
-74 682 -75 430 0 533 -3 503 -12 -90 -28 -147 -107 -147 -203 0 -101 51 -174
|
||||
146 -208 36 -13 22 -15 -181 -15 -121 -1 -237 -6 -258 -12 -21 -5 -54 -24 -74
|
||||
-42 -117 -103 -89 -293 52 -358 38 -18 101 -19 1535 -19 l1494 0 146 -145
|
||||
c120 -119 152 -145 175 -145 23 0 55 26 175 145 l146 145 74 0 75 0 -183 -183
|
||||
c-155 -155 -182 -187 -182 -212 0 -26 39 -68 283 -312 216 -216 289 -283 307
|
||||
-283 36 0 1680 1644 1680 1680 0 19 -65 89 -283 307 -305 306 -312 310 -363
|
||||
262 l-23 -21 -34 26 c-19 14 -40 26 -46 26 -7 0 1 16 18 35 57 65 61 60 -252
|
||||
372 -219 220 -288 283 -307 283 -19 0 -56 -31 -145 -120 l-120 -120 -72 0
|
||||
c-40 0 -73 3 -73 8 0 4 70 77 155 162 85 85 155 162 155 171 0 8 -16 34 -35
|
||||
57 l-35 41 397 3 c446 3 438 2 507 78 79 87 73 213 -15 298 -57 55 -100 62
|
||||
-398 62 -234 1 -262 2 -229 14 93 33 140 95 146 191 4 54 0 70 -23 114 -31 57
|
||||
-85 99 -139 108 -20 3 -36 7 -36 9 0 2 11 14 25 28 34 34 31 56 -10 96 -32 31
|
||||
-35 39 -35 91 0 32 -4 69 -9 82 -17 43 -74 100 -126 123 l-50 23 558 0 c480 1
|
||||
563 3 595 16 80 34 126 106 126 200 0 66 -15 104 -60 149 -59 59 -69 61 -324
|
||||
66 -206 4 -230 7 -195 17 49 15 102 64 126 118 36 78 16 175 -47 239 -55 55
|
||||
-79 60 -324 66 -140 3 -213 8 -194 13 17 4 48 22 68 39 95 78 102 220 17 311
|
||||
-55 60 -83 67 -278 68 l-178 0 52 24 c60 27 99 64 120 114 17 39 19 124 4 162
|
||||
-15 42 -72 100 -116 120 -38 18 -110 19 -1529 19 l-1489 0 -38 35 c-23 20 -50
|
||||
35 -64 35 -14 0 -41 -15 -64 -35 -37 -33 -42 -35 -112 -35 l-73 0 72 73 c57
|
||||
57 72 79 72 102 0 25 -40 70 -283 312 -218 218 -288 283 -307 283 -20 0 -202
|
||||
-177 -852 -828z m962 583 c89 -90 101 -105 80 -105 -17 0 -44 -20 -87 -62
|
||||
l-63 -62 -84 82 c-56 56 -91 82 -107 82 -20 0 -11 13 61 85 47 47 87 85 90 85
|
||||
3 0 52 -47 110 -105z m-233 -237 l78 -78 -75 -75 -74 -75 -87 85 c-47 47 -95
|
||||
85 -105 85 -13 0 11 30 76 95 93 94 95 95 102 68 4 -15 42 -62 85 -105z m501
|
||||
-195 c-77 -78 -83 -82 -91 -61 -4 13 -44 59 -87 103 l-80 80 65 65 c37 37 65
|
||||
73 65 85 0 14 28 -8 105 -85 l105 -105 -82 -82z m-731 -35 l78 -78 -75 -75
|
||||
-75 -75 -75 74 c-80 79 -113 101 -133 90 -6 -4 33 39 88 95 98 99 100 101 107
|
||||
74 4 -15 42 -62 85 -105z m579 -98 c13 0 -9 -28 -71 -90 -76 -76 -91 -87 -98
|
||||
-72 -5 9 -46 54 -90 99 l-82 83 75 75 74 75 87 -85 c47 -47 95 -85 105 -85z
|
||||
m-813 -127 l82 -83 -75 -75 -74 -75 -82 80 c-63 62 -88 80 -110 80 -27 0 -22
|
||||
7 71 100 87 88 100 98 103 78 2 -13 40 -60 85 -105z m1391 -2 c90 -91 96 -99
|
||||
74 -104 -12 -4 -50 -33 -83 -66 l-59 -61 -87 85 c-47 47 -95 85 -105 85 -13 0
|
||||
5 24 61 80 44 44 84 80 90 80 6 0 55 -44 109 -99z m-811 -103 c13 -2 -6 -26
|
||||
-76 -96 -77 -77 -93 -89 -94 -70 -1 12 -37 56 -85 105 l-83 83 75 75 75 75 85
|
||||
-84 c47 -46 93 -86 103 -88z m257 -22 c10 -33 10 -40 -4 -54 -15 -15 -19 -14
|
||||
-53 21 l-37 37 34 35 c38 39 34 42 60 -39z m-1155 14 c-10 -17 15 -52 91 -130
|
||||
l74 -75 -75 -75 -75 -75 -83 83 c-58 58 -90 82 -107 82 -21 0 -11 14 75 100
|
||||
95 95 114 112 100 90z m1475 -125 l80 -80 -75 -75 -75 -74 -88 87 c-49 48 -96
|
||||
87 -103 87 -7 0 27 40 76 90 84 84 90 88 98 67 4 -12 44 -58 87 -102z m500
|
||||
-200 c-72 -72 -86 -82 -87 -63 -1 12 -36 56 -84 104 l-83 83 67 70 c37 38 67
|
||||
75 67 82 0 8 46 -32 102 -89 l103 -102 -85 -85z m-1410 185 c54 -56 84 -80
|
||||
101 -80 20 0 9 -14 -71 -95 -93 -94 -95 -95 -102 -68 -4 15 -42 62 -85 105
|
||||
l-77 78 69 70 c38 38 74 70 79 70 5 0 44 -36 86 -80z m450 15 l34 -35 -69 0
|
||||
-69 0 34 35 c19 19 34 35 35 35 1 0 16 -16 35 -35z m-1160 -230 l80 -80 -75
|
||||
-75 -75 -74 -84 82 c-57 56 -91 82 -107 82 -20 0 -8 15 71 95 88 88 95 93 103
|
||||
72 4 -12 44 -58 87 -102z m1386 5 l84 -85 -75 -75 -75 -75 -83 83 c-58 58 -90
|
||||
82 -107 82 -21 0 -12 13 70 95 71 72 96 91 98 78 2 -10 42 -56 88 -103z m-911
|
||||
-20 c47 -47 91 -82 103 -83 19 -1 7 -17 -70 -94 -71 -72 -94 -89 -96 -75 -2
|
||||
10 -41 56 -87 102 l-85 85 72 72 c40 40 75 73 78 73 2 0 41 -36 85 -80z m1390
|
||||
0 c47 -47 91 -82 103 -83 19 -1 7 -17 -70 -94 -71 -72 -94 -89 -96 -75 -2 10
|
||||
-39 54 -82 97 -44 44 -80 84 -80 90 0 9 130 145 140 145 2 0 41 -36 85 -80z
|
||||
m3148 -1468 c-50 -37 -187 -41 -253 -7 -19 9 -311 292 -649 629 -672 670 -661
|
||||
656 -661 772 0 60 13 117 33 142 8 10 189 -165 779 -755 684 -683 766 -769
|
||||
751 -781z m-5246 1246 l77 -78 -61 -62 c-34 -35 -63 -73 -65 -86 -3 -20 -17
|
||||
-9 -108 83 l-105 105 85 85 c84 84 85 85 92 58 4 -15 42 -62 85 -105z m1389
|
||||
12 l84 -85 -75 -75 -75 -74 -84 82 c-57 56 -91 82 -107 82 -20 0 -8 15 71 95
|
||||
71 72 96 91 98 78 2 -10 42 -56 88 -103z m1472 -108 c-13 -2 -51 -31 -85 -65
|
||||
l-63 -61 -84 82 c-46 45 -92 82 -102 82 -13 0 7 26 66 85 l85 85 103 -102 c89
|
||||
-90 100 -103 80 -106z m-2377 83 c47 -47 93 -85 100 -85 7 0 -27 -40 -76 -90
|
||||
l-89 -89 -12 27 c-7 15 -46 61 -88 102 l-76 75 72 72 c40 40 75 73 77 73 3 0
|
||||
44 -38 92 -85z m1390 0 c47 -47 93 -85 100 -85 7 0 -27 -40 -76 -90 l-89 -89
|
||||
-12 27 c-7 15 -46 61 -88 102 l-76 75 72 72 c40 40 75 73 77 73 3 0 44 -38 92
|
||||
-85z m-966 25 c17 -7 14 -9 -13 -9 -20 -1 -31 3 -27 9 7 12 13 12 40 0z m248
|
||||
-237 l82 -83 -75 -75 -75 -75 -85 85 c-49 49 -94 85 -105 85 -14 0 6 26 75 95
|
||||
83 84 95 93 98 73 2 -13 40 -60 85 -105z m1395 -5 l77 -78 -75 -75 -75 -75
|
||||
-85 85 c-47 47 -92 85 -100 85 -8 0 26 40 75 90 84 84 90 88 98 67 4 -12 42
|
||||
-57 85 -99z m500 -195 c-77 -78 -83 -82 -91 -61 -4 13 -42 58 -84 100 l-77 77
|
||||
62 65 c40 41 62 73 62 87 0 20 19 5 105 -81 l105 -105 -82 -82z m-2710 100
|
||||
c21 -8 17 -14 -61 -91 l-82 -82 -105 105 c-77 77 -99 105 -85 105 12 0 48 28
|
||||
85 65 l65 65 80 -80 c44 -43 90 -83 103 -87z m1298 82 c45 -47 90 -85 100 -85
|
||||
13 0 -10 -29 -71 -90 l-89 -89 -13 27 c-8 16 -47 62 -88 102 l-75 75 72 72
|
||||
c40 40 75 73 78 73 2 0 41 -38 86 -85z m-802 -100 c-4 -10 24 -46 82 -105 l88
|
||||
-90 -74 -75 -74 -75 -87 85 c-47 47 -95 85 -105 85 -13 0 11 30 76 95 52 52
|
||||
96 95 97 95 1 0 0 -7 -3 -15z m1479 -112 l82 -83 -75 -75 -74 -75 -87 85 c-47
|
||||
47 -92 85 -98 85 -7 0 27 43 76 95 76 82 88 92 91 73 2 -13 40 -60 85 -105z
|
||||
m-807 -103 c13 0 -9 -28 -71 -90 -76 -76 -91 -87 -98 -72 -5 9 -46 54 -90 99
|
||||
l-82 83 75 75 74 75 87 -85 c47 -47 95 -85 105 -85z m1279 89 c39 -39 82 -76
|
||||
97 -83 l27 -12 -89 -89 c-50 -49 -90 -83 -90 -75 0 9 -38 53 -85 100 l-85 85
|
||||
72 72 c40 40 75 73 78 73 3 0 37 -32 75 -71z m1599 -412 c-13 -15 -24 -38 -24
|
||||
-50 0 -16 -43 21 -175 153 -172 172 -175 175 -147 182 16 4 37 17 47 28 19 21
|
||||
20 20 171 -131 l153 -153 -25 -29z m-3690 184 l75 -75 -64 -67 c-36 -37 -65
|
||||
-75 -65 -85 0 -13 -33 14 -100 81 -55 55 -100 104 -100 110 0 5 35 44 77 87
|
||||
l77 77 12 -27 c7 -15 46 -61 88 -101z m3258 -309 c341 -340 438 -443 438 -462
|
||||
0 -20 -186 -211 -868 -893 -563 -563 -874 -867 -887 -867 -25 0 -893 865 -902
|
||||
899 -5 20 99 128 863 892 682 682 874 869 894 869 19 0 122 -97 462 -438z
|
||||
m150 151 c189 -189 288 -295 288 -308 0 -11 -7 -29 -15 -39 -8 -11 -15 -29
|
||||
-15 -40 0 -15 -98 77 -330 309 -326 326 -330 330 -301 338 17 4 33 12 36 17
|
||||
20 33 58 2 337 -277z m-2027 179 l89 -92 -74 -75 -75 -75 -75 74 c-41 41 -86
|
||||
79 -99 86 -23 12 -23 13 60 96 45 46 83 82 84 81 0 -1 41 -44 90 -95z m-900
|
||||
-32 c43 -43 87 -80 97 -82 14 -2 -3 -25 -75 -96 -77 -77 -93 -89 -94 -70 -1
|
||||
12 -37 56 -85 105 l-83 83 70 70 c38 38 74 70 80 70 6 0 46 -36 90 -80z m1390
|
||||
0 c47 -47 88 -80 100 -80 14 0 -3 -23 -70 -90 l-89 -89 -17 27 c-9 15 -49 58
|
||||
-88 97 l-71 69 72 73 c40 40 75 73 78 73 3 0 41 -36 85 -80z m478 -8 l57 -57
|
||||
-425 -425 -425 -425 -60 60 -60 60 422 422 c233 233 425 423 428 423 3 0 31
|
||||
-26 63 -58z m-1192 -207 l79 -80 -75 -75 -75 -75 -83 83 c-47 47 -91 82 -102
|
||||
82 -14 0 5 24 70 90 76 76 91 87 98 72 5 -9 45 -53 88 -97z m-921 -10 c41 -42
|
||||
87 -79 103 -83 27 -7 27 -7 -58 -92 l-85 -85 -100 100 -99 99 27 17 c15 9 49
|
||||
40 77 68 27 28 52 51 55 51 3 0 39 -34 80 -75z m1405 -5 c47 -47 88 -80 100
|
||||
-80 14 0 -5 -25 -75 -95 -94 -95 -95 -95 -102 -68 -4 16 -41 62 -83 103 l-75
|
||||
75 72 72 c40 40 75 73 78 73 3 0 41 -36 85 -80z m-719 -210 l84 -85 -75 -75
|
||||
-75 -74 -84 82 c-46 45 -92 82 -102 82 -13 0 9 28 71 90 50 50 92 85 94 78 2
|
||||
-7 41 -51 87 -98z m576 -107 c15 -7 4 -22 -72 -98 -66 -65 -90 -84 -90 -70 0
|
||||
11 -35 55 -82 102 l-83 83 75 75 75 75 80 -79 c44 -43 88 -83 97 -88z m-804
|
||||
-135 l76 -78 -61 -62 c-34 -35 -63 -73 -65 -86 -3 -20 -16 -9 -106 81 l-104
|
||||
104 84 81 c77 75 83 80 91 59 4 -12 42 -57 85 -99z m574 -95 c15 -7 4 -22 -72
|
||||
-98 -62 -62 -90 -84 -90 -71 0 10 -37 56 -82 102 l-82 84 74 75 75 75 80 -79
|
||||
c44 -43 88 -83 97 -88z m-326 -153 c45 -44 90 -80 100 -80 13 0 -7 -26 -66
|
||||
-85 l-85 -85 -102 102 c-102 102 -103 103 -76 110 16 4 53 32 83 63 30 30 56
|
||||
55 59 55 3 0 42 -36 87 -80z m3157 -402 c-15 -4 -53 -33 -85 -65 l-58 -57 -84
|
||||
82 c-46 45 -92 82 -102 82 -13 0 7 26 66 85 l85 85 102 -102 c101 -101 103
|
||||
-103 76 -110z m-913 -363 l-425 -425 -60 60 -60 60 425 425 425 425 60 -60 60
|
||||
-60 -425 -425z m608 233 l77 -78 -75 -75 -75 -75 -85 85 c-47 47 -92 85 -100
|
||||
85 -8 0 26 40 75 90 84 84 90 88 98 67 4 -12 42 -57 85 -99z m502 -203 c-84
|
||||
-84 -85 -85 -92 -58 -4 15 -42 62 -85 105 l-77 78 62 63 c42 43 62 70 62 87 0
|
||||
21 16 9 107 -82 l108 -108 -85 -85z m-737 -22 l82 -83 -75 -75 -74 -75 -87 85
|
||||
c-47 47 -93 85 -100 85 -7 0 27 41 76 90 68 68 91 86 93 73 2 -10 40 -55 85
|
||||
-100z m477 -18 c41 -42 87 -79 103 -83 27 -7 27 -8 -68 -102 -70 -70 -95 -89
|
||||
-95 -75 0 12 -35 55 -85 105 l-85 85 72 72 c40 40 75 73 78 73 3 0 39 -34 80
|
||||
-75z m-707 -212 l82 -83 -75 -75 -74 -75 -82 80 c-55 54 -89 80 -105 80 -20 0
|
||||
-8 15 71 95 71 72 96 91 98 78 2 -10 40 -55 85 -100z m1392 -3 c55 -55 94
|
||||
-100 86 -100 -7 0 -44 -30 -82 -67 l-70 -67 -83 83 c-48 47 -92 83 -104 84
|
||||
-19 1 -9 15 60 84 45 46 85 83 88 83 3 0 50 -45 105 -100z m-910 -20 c57 -58
|
||||
87 -80 105 -80 21 0 13 -12 -70 -95 l-94 -94 -12 27 c-7 15 -46 61 -88 102
|
||||
l-76 75 72 72 c40 40 75 73 78 73 3 0 41 -36 85 -80z m678 -217 l82 -83 -70
|
||||
-70 c-38 -38 -74 -70 -80 -70 -6 0 -46 36 -90 80 -47 47 -88 80 -100 80 -14 0
|
||||
5 25 75 95 83 84 95 93 98 73 2 -13 40 -60 85 -105z m-1392 2 l79 -80 -75 -75
|
||||
-75 -75 -83 83 c-47 47 -91 82 -102 82 -14 0 5 24 70 90 76 76 91 87 98 72 5
|
||||
-9 45 -53 88 -97z m1969 -120 c0 -6 -36 -46 -80 -90 -56 -56 -80 -74 -80 -61
|
||||
0 10 -38 58 -85 105 l-85 87 61 59 c33 33 62 71 66 83 5 22 13 16 104 -74 55
|
||||
-54 99 -103 99 -109z m-1495 114 c39 -39 82 -79 97 -88 l27 -17 -88 -88 -88
|
||||
-88 -12 29 c-7 16 -45 63 -86 103 l-75 75 72 72 c40 40 75 73 78 73 3 0 37
|
||||
-32 75 -71z m-704 -224 l79 -80 -75 -75 -75 -74 -84 82 c-46 45 -92 82 -102
|
||||
82 -13 0 9 28 71 90 76 76 91 87 98 72 5 -9 45 -53 88 -97z m1392 -2 l82 -83
|
||||
-75 -75 -74 -75 -87 85 c-47 47 -95 85 -105 85 -13 0 9 28 71 90 76 76 91 87
|
||||
98 72 5 -9 46 -54 90 -99z m-816 -100 c21 -8 16 -15 -72 -103 -82 -82 -95 -91
|
||||
-95 -70 0 17 -24 49 -82 107 l-83 83 75 75 75 75 80 -80 c44 -43 90 -83 102
|
||||
-87z m1390 0 c21 -8 16 -15 -72 -103 -53 -52 -93 -87 -89 -77 5 13 -16 40 -82
|
||||
107 l-88 90 74 75 75 75 80 -80 c44 -43 90 -83 102 -87z m-2200 -135 l77 -77
|
||||
-62 -65 c-40 -41 -62 -73 -62 -87 0 -20 -19 -5 -105 81 l-105 105 82 82 c77
|
||||
78 83 82 91 61 4 -13 42 -58 84 -100z m1391 10 l87 -88 -75 -75 -74 -75 -87
|
||||
85 c-47 47 -95 85 -105 85 -13 0 9 28 71 90 50 50 92 85 94 78 2 -7 42 -52 89
|
||||
-100z m1474 -106 c-10 -2 -47 -32 -82 -67 l-64 -65 -87 85 c-47 47 -95 85
|
||||
-105 85 -13 0 7 26 66 85 l85 85 103 -102 c78 -78 98 -104 84 -106z m-2279 -4
|
||||
c13 -2 -6 -27 -78 -98 -80 -79 -95 -91 -95 -71 0 16 -26 50 -82 107 l-82 84
|
||||
74 75 75 75 85 -84 c47 -46 93 -86 103 -88z m1390 0 c13 -2 -6 -27 -78 -98
|
||||
-82 -82 -95 -91 -95 -70 0 17 -24 49 -82 107 l-83 83 75 75 75 75 85 -84 c47
|
||||
-46 93 -86 103 -88z m-813 -133 l80 -80 -75 -75 -75 -74 -88 87 c-49 48 -96
|
||||
87 -103 87 -7 0 27 40 76 90 84 84 90 88 98 67 4 -12 44 -58 87 -102z m1390 0
|
||||
l80 -80 -75 -75 -75 -74 -88 87 c-49 48 -96 87 -103 87 -7 0 27 40 76 90 84
|
||||
84 90 88 98 67 4 -12 44 -58 87 -102z m470 -150 l-75 -75 -75 75 -75 75 63 63
|
||||
c42 43 62 70 62 87 0 22 11 13 87 -62 l88 -88 -75 -75z m-1277 53 c13 -2 -6
|
||||
-27 -78 -98 -80 -79 -95 -91 -95 -71 0 16 -26 50 -82 107 l-82 84 74 75 75 75
|
||||
85 -84 c47 -46 93 -86 103 -88z m-1503 87 c41 -42 87 -79 103 -83 27 -7 27 -7
|
||||
-58 -92 l-85 -85 -105 105 c-93 93 -103 105 -82 108 13 2 50 30 82 63 33 32
|
||||
62 59 65 59 3 0 39 -34 80 -75z m686 -215 l84 -85 -75 -75 -75 -75 -83 83
|
||||
c-49 48 -93 84 -105 85 -19 1 -7 17 70 94 70 70 94 89 96 76 2 -10 42 -56 88
|
||||
-103z m1390 0 l84 -85 -75 -75 -75 -75 -83 83 c-49 48 -93 84 -105 85 -19 1
|
||||
-7 17 70 94 70 70 94 89 96 76 2 -10 42 -56 88 -103z m-911 -20 c57 -58 87
|
||||
-80 105 -80 21 0 12 -12 -70 -95 -72 -73 -96 -91 -98 -77 -2 10 -41 56 -87
|
||||
102 l-85 85 72 72 c40 40 75 73 78 73 3 0 41 -36 85 -80z m1383 7 l72 -72 -75
|
||||
-75 -75 -74 -75 74 -75 75 72 72 c40 40 75 73 78 73 3 0 38 -33 78 -73z
|
||||
m-2091 -229 l77 -78 -61 -62 c-33 -35 -65 -71 -70 -80 -7 -15 -24 -3 -108 82
|
||||
l-100 100 85 85 c84 84 85 85 92 58 4 -15 42 -62 85 -105z m1383 17 c44 -44
|
||||
80 -84 80 -90 0 -6 -31 -42 -70 -80 l-70 -69 -84 82 c-57 56 -91 82 -107 82
|
||||
-20 0 -8 15 71 95 72 73 96 91 98 77 2 -10 39 -54 82 -97z m-290 77 c0 -4 -49
|
||||
-56 -109 -116 l-110 -109 -7 39 c-3 21 -11 47 -16 58 -8 15 0 29 48 77 l58 59
|
||||
68 0 c37 0 68 -3 68 -8z m-608 -108 c65 -64 92 -85 105 -80 10 4 -25 -36 -77
|
||||
-88 l-94 -95 -12 27 c-7 15 -46 61 -88 102 l-76 75 72 72 c40 40 75 73 77 73
|
||||
3 0 44 -39 93 -86z m1376 13 l72 -72 -75 -75 -75 -74 -75 74 -75 75 72 72 c40
|
||||
40 75 73 78 73 3 0 38 -33 78 -73z m-791 -119 c1 -12 37 -57 85 -105 l83 -83
|
||||
-75 -75 -75 -75 -85 85 c-49 49 -94 85 -105 85 -14 0 6 26 75 95 52 52 95 95
|
||||
95 95 0 0 1 -10 2 -22z m-721 -208 c13 0 -7 -26 -66 -85 l-85 -85 -102 102
|
||||
-102 102 27 12 c15 6 52 37 82 68 l54 56 87 -85 c47 -47 95 -85 105 -85z
|
||||
m1276 103 c38 -37 68 -72 68 -78 0 -6 -32 -42 -70 -80 l-70 -69 -75 74 -75 75
|
||||
72 72 c40 40 75 73 77 73 3 0 36 -30 73 -67z m-699 -230 l82 -83 -75 -75 -74
|
||||
-75 -87 85 c-47 47 -95 85 -105 85 -13 0 9 28 71 90 76 76 91 87 98 72 5 -9
|
||||
46 -54 90 -99z m467 -158 l-75 -75 -75 75 -75 75 75 75 75 75 75 -75 75 -75
|
||||
-75 -75z m-700 -80 l80 -80 -65 -65 c-37 -37 -65 -73 -65 -85 0 -14 -28 8
|
||||
-105 85 l-105 105 82 82 c77 78 83 82 91 61 4 -13 44 -59 87 -103z m470 -150
|
||||
l-75 -75 -75 75 -75 75 75 75 75 75 75 -75 75 -75 -75 -75z m-232 -88 l72 -72
|
||||
-75 -75 -75 -75 -88 88 c-77 77 -84 87 -62 87 18 0 44 18 85 60 33 33 62 60
|
||||
65 60 3 0 38 -33 78 -73z"/>
|
||||
<path d="M3847 4622 c-10 -10 -17 -28 -17 -40 0 -30 721 -752 750 -752 25 0
|
||||
60 34 60 57 0 26 -730 753 -756 753 -12 0 -28 -8 -37 -18z"/>
|
||||
<path d="M3233 3698 c-475 -475 -633 -639 -633 -656 0 -38 18 -62 48 -62 22 0
|
||||
133 106 660 633 673 674 664 663 610 701 -12 9 -29 16 -38 16 -8 0 -299 -285
|
||||
-647 -632z"/>
|
||||
<path d="M3846 3998 c-21 -30 -20 -51 3 -72 27 -25 72 -17 90 15 13 24 13 29
|
||||
-2 53 -22 34 -69 36 -91 4z"/>
|
||||
<path d="M3612 3307 c-665 -665 -667 -667 -613 -697 50 -26 47 -29 699 623
|
||||
347 348 632 639 632 647 0 9 -7 26 -16 38 -38 55 -27 64 -702 -611z"/>
|
||||
<path d="M3778 3778 c-30 -24 -31 -56 -3 -83 27 -28 59 -27 83 3 40 51 -29
|
||||
120 -80 80z"/>
|
||||
<path d="M3533 3684 c-15 -24 -15 -29 -2 -53 28 -49 109 -32 109 24 0 54 -77
|
||||
75 -107 29z"/>
|
||||
<path d="M3466 3467 c-23 -16 -24 -63 -3 -84 21 -21 68 -20 84 3 41 56 -25
|
||||
122 -81 81z"/>
|
||||
<path d="M3223 3374 c-15 -24 -15 -29 -2 -53 28 -49 109 -32 109 24 0 54 -77
|
||||
75 -107 29z"/>
|
||||
<path d="M3158 3159 c-21 -12 -24 -69 -6 -87 20 -20 76 -15 88 7 32 61 -23
|
||||
115 -82 80z"/>
|
||||
<path d="M2308 3079 c-11 -6 -18 -22 -18 -42 0 -28 37 -69 358 -389 321 -321
|
||||
361 -358 389 -358 37 0 58 28 49 63 -8 33 -717 737 -741 737 -11 0 -28 -5 -37
|
||||
-11z"/>
|
||||
<path d="M2915 3067 c-21 -33 -6 -74 31 -83 48 -12 85 27 68 73 -8 23 -16 29
|
||||
-46 31 -30 3 -40 -1 -53 -21z"/>
|
||||
<path d="M5819 6966 c-68 -28 -106 -54 -149 -103 -106 -120 -120 -321 -31
|
||||
-453 l30 -44 -32 -11 c-58 -18 -44 -93 20 -110 14 -3 49 1 79 10 48 14 59 14
|
||||
97 1 70 -24 131 -29 193 -16 126 26 230 107 282 220 36 77 42 192 14 274 -18
|
||||
52 -18 62 -6 92 40 94 -14 189 -80 141 -10 -8 -18 -25 -18 -40 l0 -27 -31 22
|
||||
c-64 46 -137 68 -227 68 -66 0 -98 -6 -141 -24z m252 -106 c24 -12 56 -33 71
|
||||
-47 l26 -25 -18 -31 c-40 -67 -206 -237 -307 -316 -50 -38 -68 -36 -104 17
|
||||
-69 98 -66 232 7 327 73 96 217 129 325 75z m145 -323 c-32 -110 -142 -191
|
||||
-250 -185 l-57 3 55 43 c30 23 101 92 158 152 l103 110 3 -35 c2 -20 -4 -59
|
||||
-12 -88z"/>
|
||||
<path d="M3295 6426 c-13 -19 -13 -28 -4 -50 16 -33 44 -42 74 -22 17 11 25
|
||||
26 25 46 0 51 -67 69 -95 26z"/>
|
||||
<path d="M6577 3482 c-13 -15 -17 -39 -17 -110 l0 -92 -39 0 c-40 0 -71 -25
|
||||
-71 -57 0 -25 39 -53 75 -53 l35 0 0 -90 c0 -77 3 -93 20 -110 11 -11 27 -20
|
||||
35 -20 8 0 24 9 35 20 17 17 20 33 20 110 l0 90 35 0 c39 0 75 28 75 58 0 29
|
||||
-33 52 -73 52 l-37 0 0 93 c0 78 -3 97 -18 110 -24 22 -55 21 -75 -1z"/>
|
||||
<path d="M676 1734 c-12 -12 -16 -37 -16 -110 l0 -94 -39 0 c-45 0 -71 -20
|
||||
-71 -55 0 -30 35 -55 77 -55 l33 0 0 -94 c0 -95 4 -105 43 -119 12 -5 26 2 43
|
||||
18 22 22 24 32 24 110 l0 85 29 0 c43 0 61 10 72 38 15 40 -12 72 -61 72 l-40
|
||||
0 0 88 c0 63 -4 94 -16 110 -18 26 -56 29 -78 6z"/>
|
||||
<path d="M2864 646 c-16 -12 -20 -29 -22 -110 l-4 -96 -30 0 c-48 0 -68 -16
|
||||
-68 -55 0 -39 20 -55 69 -55 l31 0 0 -79 c0 -44 4 -91 10 -105 12 -34 54 -44
|
||||
80 -21 17 16 20 31 20 112 l0 93 39 0 c45 0 71 20 71 54 0 33 -31 56 -73 56
|
||||
l-37 0 0 94 c0 87 -2 96 -22 110 -28 20 -39 20 -64 2z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 17 KiB |
|
|
@ -6,8 +6,8 @@ import ProgressBar from "./components/ProgressBar";
|
|||
import "./App.css";
|
||||
|
||||
function App() {
|
||||
const [longitude, setLongitude] = useState("");
|
||||
const [latitude, setLatitude] = useState("");
|
||||
const [longitude, setLongitude] = useState(0);
|
||||
const [latitude, setLatitude] = useState(0);
|
||||
const [progress, setProgress] = useState(0);
|
||||
|
||||
async function fetchISSData() {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ import {
|
|||
Marker,
|
||||
Sphere,
|
||||
} from "react-simple-maps";
|
||||
import jsonData from "./map-image.json"
|
||||
|
||||
const geoUrl =
|
||||
"https://raw.githubusercontent.com/zcreativelabs/react-simple-maps/master/topojson-maps/world-110m.json";
|
||||
|
||||
const Map = ({ latitude, longitude }) => {
|
||||
// Icon alignment offset fix
|
||||
|
|
@ -19,7 +21,7 @@ const Map = ({ latitude, longitude }) => {
|
|||
<ComposableMap projection="geoEqualEarth" width={2400}>
|
||||
<Graticule stroke="rgba(255, 255, 255, 0.5)" />
|
||||
<Sphere stroke="#FF5533" strokeWidth={2} />
|
||||
<Geographies geography={jsonData}>
|
||||
<Geographies geography={geoUrl}>
|
||||
{({ geographies }) =>
|
||||
geographies.map((geo) => (
|
||||
<Geography
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import React from "react";
|
|||
import ReactDOM from "react-dom";
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
import * as serviceWorkerRegistration from "./serviceWorkerRegistration";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
|
||||
ReactDOM.render(
|
||||
|
|
@ -12,11 +11,6 @@ ReactDOM.render(
|
|||
document.getElementById("root")
|
||||
);
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://cra.link/PWA
|
||||
serviceWorkerRegistration.register();
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
// This service worker can be customized!
|
||||
// See https://developers.google.com/web/tools/workbox/modules
|
||||
// for the list of available Workbox modules, or add any other
|
||||
// code you'd like.
|
||||
// You can also remove this file if you'd prefer not to use a
|
||||
// service worker, and the Workbox build step will be skipped.
|
||||
|
||||
import { clientsClaim } from 'workbox-core';
|
||||
import { ExpirationPlugin } from 'workbox-expiration';
|
||||
import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
|
||||
import { registerRoute } from 'workbox-routing';
|
||||
import { StaleWhileRevalidate } from 'workbox-strategies';
|
||||
|
||||
clientsClaim();
|
||||
|
||||
// Precache all of the assets generated by your build process.
|
||||
// Their URLs are injected into the manifest variable below.
|
||||
// This variable must be present somewhere in your service worker file,
|
||||
// even if you decide not to use precaching. See https://cra.link/PWA
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
|
||||
// Set up App Shell-style routing, so that all navigation requests
|
||||
// are fulfilled with your index.html shell. Learn more at
|
||||
// https://developers.google.com/web/fundamentals/architecture/app-shell
|
||||
const fileExtensionRegexp = new RegExp('/[^/?]+\\.[^/]+$');
|
||||
registerRoute(
|
||||
// Return false to exempt requests from being fulfilled by index.html.
|
||||
({ request, url }) => {
|
||||
// If this isn't a navigation, skip.
|
||||
if (request.mode !== 'navigate') {
|
||||
return false;
|
||||
} // If this is a URL that starts with /_, skip.
|
||||
|
||||
if (url.pathname.startsWith('/_')) {
|
||||
return false;
|
||||
} // If this looks like a URL for a resource, because it contains // a file extension, skip.
|
||||
|
||||
if (url.pathname.match(fileExtensionRegexp)) {
|
||||
return false;
|
||||
} // Return true to signal that we want to use the handler.
|
||||
|
||||
return true;
|
||||
},
|
||||
createHandlerBoundToURL(process.env.PUBLIC_URL + '/index.html')
|
||||
);
|
||||
|
||||
// An example runtime caching route for requests that aren't handled by the
|
||||
// precache, in this case same-origin .png requests like those from in public/
|
||||
registerRoute(
|
||||
// Add in any other file extensions or routing criteria as needed.
|
||||
({ url }) => url.origin === self.location.origin && url.pathname.endsWith('.png'), // Customize this strategy as needed, e.g., by changing to CacheFirst.
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: 'images',
|
||||
plugins: [
|
||||
// Ensure that once this runtime cache reaches a maximum size the
|
||||
// least-recently used images are removed.
|
||||
new ExpirationPlugin({ maxEntries: 50 }),
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
// This allows the web app to trigger skipWaiting via
|
||||
// registration.waiting.postMessage({type: 'SKIP_WAITING'})
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event.data && event.data.type === 'SKIP_WAITING') {
|
||||
self.skipWaiting();
|
||||
}
|
||||
});
|
||||
|
||||
// Any other custom service worker logic can go here.
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
// This lets the app load faster on subsequent visits in production, and gives
|
||||
// it offline capabilities. However, it also means that developers (and users)
|
||||
// will only see deployed updates on subsequent visits to a page, after all the
|
||||
// existing tabs open on the page have been closed, since previously cached
|
||||
// resources are updated in the background.
|
||||
|
||||
// To learn more about the benefits of this model and instructions on how to
|
||||
// opt-in, read https://cra.link/PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
|
||||
);
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://cra.link/PWA'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function registerValidSW(swUrl, config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then((registration) => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
if (installingWorker == null) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://cra.link/PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
config.onUpdate(registration);
|
||||
}
|
||||
} else {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
config.onSuccess(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl, {
|
||||
headers: { 'Service-Worker': 'script' },
|
||||
})
|
||||
.then((response) => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Service worker found. Proceed as normal.
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('No internet connection found. App is running in offline mode.');
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready
|
||||
.then((registration) => {
|
||||
registration.unregister();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||