iamshaunjp / pwa-tutorial Goto Github PK
View Code? Open in Web Editor NEWCourse files for the progressive web app tutorial series on The Net Ninja YouTube channel.
Course files for the progressive web app tutorial series on The Net Ninja YouTube channel.
This is my sw.js
const staticDevCoffee = "dev-coffee-site-v1";
const dynamicCacheName = "dev-coffee-dynamic-v4";
const assets = [
"/",
"/index.html",
"/fallback.html",
"/about.html",
"/contact.html",
"/blog.html",
"/css/style.css",
"/js/app.js",
"/images/coffee1.jpg",
"/images/coffee2.jpg",
"/images/coffee3.jpg",
"/images/coffee4.jpg",
"/images/coffee5.jpg",
"/images/coffee6.jpg",
"/images/coffee7.jpg",
"/images/coffee8.jpg",
"/images/coffee9.jpg",
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(staticDevCoffee).then(cache => {
cache.addAll(assets)
})
);
});
self.addEventListener('activate', activateEvent => {
activateEvent.waitUntil(
caches.keys().then(keys => {
return Promise.all(keys
.filter(key => key !== staticDevCoffee && key !== dynamicCacheName)
.map(key => caches.delete(key))
);
})
);
});
self.addEventListener('fetch', fetchEvent => {
if(!(fetchEvent.request.url.indexOf("http") === 0)) return
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(cacheRes => {
return cacheRes || fetch(fetchEvent.request).then(fetchRes => {
return caches.open(staticDevCoffee).then(cache => {
cache.put(fetchEvent.request.url, fetchRes.clone());
return fetchRes;
})
});
}).catch(()=> caches.match("/fallback.html"))
);
});
After adding cache delete method in fetch method sw returning staticCacheName but empty
I'm trying to use your code as a base of my uni project but I'm havnig problems:
Uncaught TypeError: Cannot read property 'innerHTML' of null
Lesson - 21
I have just downloaded the code and ran it with the live server. While performing a lighthouse audit, it doesn't load at all.
There's some issue with the manifest.json file because the audit run when the file was removed.
The back button/navigation not working as the native apps.
If the back button is pressed on the home page then the app must be closed even if we have visited other pages but it's not.
Side menu icon not clickable in IOS chrome/safari.
Below Add button working fine.
Directed here from the YouTube tutorial series. For me, I see nothing but a readme file and an empty repo.
Did this get moved somewhere?
It says 4 issues in materialize css file and wont load properly in live server
I was using a lot the samples to build my own PWA app, I don't know what changed on my VSCode that I cannot run the sample code with Live Server. I get a weird problem with subfolders.
If I remove the first slash from de references it works:
Example: If I change "" into ""
I'll appreciate if someone can give me some help to solve this issue, it happen to me not just with this sample project but also with my own projects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.