-
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.
- Loading branch information
Showing
16 changed files
with
228 additions
and
54 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.vscode/ | ||
config.js | ||
config.js | ||
# Local Netlify folder | ||
.netlify |
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.
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.
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.
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.
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
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,74 @@ | ||
{ | ||
"name":"WeatherNow", | ||
"short_name":"WeatherNow", | ||
"description":"A simple weather forecast appthat shows current weather condition of your location or a place", | ||
"display":"standalone", | ||
"theme_color":"#d4d4d4", | ||
"background_color":"#ffffff", | ||
"start_url":"index.html", | ||
"orientation":"portrait", | ||
"icons":[ | ||
{ | ||
"src":"/icons/weatherIcon-48x48.png", | ||
"sizes":"48x48", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-72x72.png", | ||
"sizes":"72x72", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-96x96.png", | ||
"sizes":"96x96", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-120x120.png", | ||
"sizes":"120x120", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-144x144.png", | ||
"sizes":"144x144", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-152x152.png", | ||
"sizes":"152x152", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-167x167.png", | ||
"sizes":"167x167", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-180x180.png", | ||
"sizes":"180x180", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-192x192.png", | ||
"sizes":"192x192", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
}, | ||
{ | ||
"src":"/icons/weatherIcon-512x512.png", | ||
"sizes":"512x512", | ||
"type":"image/png", | ||
"purpose":"any maskable" | ||
} | ||
|
||
] | ||
|
||
} |
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 |
---|---|---|
|
@@ -360,3 +360,5 @@ label{ | |
} | ||
} | ||
|
||
|
||
|
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,49 @@ | ||
const cacheName = 'watheranowCache-v1'; | ||
const cachedAssets = [ | ||
'/', | ||
'index.js', | ||
'/index.html', | ||
'style.css', | ||
'https://fonts.googleapis.com/css2?family=Roboto&display=swap', | ||
'https://fonts.googleapis.com/css2?family=Lato:wght@400&display=swap', | ||
'https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2', | ||
'https://fonts.gstatic.com/s/lato/v17/S6uyw4BMUTPHjxAwXiWtFCfQ7A.woff2', | ||
'img/day.webp', | ||
'img/barometer.svg', | ||
'img/humidity.svg', | ||
'img/icons8-search.svg', | ||
'img/pin (1).svg', | ||
'img/uv-protection.svg', | ||
'img/wind.svg' | ||
] | ||
|
||
//install event | ||
self.addEventListener('install',(evt)=>{ | ||
// console.log('service worker installed') | ||
evt.waitUntil(caches.open(cacheName) | ||
.then(cache=>{ | ||
cache.addAll(cachedAssets) | ||
})) | ||
}) | ||
|
||
// activate event | ||
self.addEventListener('activate',evt=>{ | ||
// console.log('service worker activated') | ||
evt.waitUntil( | ||
caches.keys().then(keys=>{ | ||
return Promise.all(keys | ||
.filter(key => key !== cacheName) | ||
.map(key=>caches.delete(key))) | ||
}) | ||
) | ||
}) | ||
|
||
self.addEventListener('fetch',evt=>{ | ||
// console.log('fetch request successful') | ||
evt.respondWith( | ||
caches.match(evt.request) | ||
.then(cacheRes=>{ | ||
return cacheRes || fetch(evt.request) | ||
}) | ||
) | ||
}) |