talater / gotham_imperial_hotel Goto Github PK
View Code? Open in Web Editor NEWπ Code for Building Progressive Web Apps book
Home Page: https://pwabook.com/
License: MIT License
π Code for Building Progressive Web Apps book
Home Page: https://pwabook.com/
License: MIT License
Could I ask once you have downloaded the files to your local directory and have it working via the terminal and the local server and you then log off/log on the computer. How do you reconnect to the local server? I do npm start but nothing happens.
Many thanks
JM
I am attempting to add the code under the paragraph with header:
Adding Data to an Object Store
In chrome developer console I am getting the following error message:
Uncaught DOMException: Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
at IDBOpenDBRequest.request.onsuccess (http://localhost:8443/indexeddb.html:33:21)
Hi,
The issue I came across occurs in Chrome and Safari, whereas works fine in Firefox(most of the time). fetch() request for events.json always resolves even in offline mode. I have added an OnlineState counter as you can see in the below code. Chrome keeps triggering this Online state even in offline mode (as can be observed from the added number of Online Requests) whereas Safari most of the time does not trigger this resolved promise at all (as can be observed from the not increasing number of Online Request). Safari only triggers Resolve function when I shift+refresh the page to delete cache and only then on my following regular refresh I can see the Resolve function triggered. So I think this is a browser file caching related problem. However, how come a failed fetch event, trigger a function inside a resolved promise in Chrome? And how come a supposedly successful fetch event not resolve in Safari?
//Added this variable before the serviceWorker fetch eventListener
var onlineRequest = 0;
// Handle requests for events JSON file
} else if (requestURL.pathname === "/events.json") {
event.respondWith(
caches.open(CACHE_NAME).then(function(cache) {
return fetch(event.request).then(function(networkResponse) {
console.log("ONLINE: ", onlineRequest++);
cache.put(event.request, networkResponse.clone());
return networkResponse;
}).catch(function() {
console.log("OFFLINE");
return caches.match(event.request);
});
})
);
Could you help with this issue?
I have added the following code at the top of js/app.js file:
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("../serviceworker.js")
.then(function(registration) {
console.log("Service Worker registered with scope:", registration.scope);
}).catch(function(err) {
console.log("Service Worker registration failed:", err);
});
}
Then I am simulating an offline state in Chrome (also in Firefox and Safari). I do not see the error message but this one instead:
This site canβt be reached
localhost refused to connect.
Search Google for localhost 8443
ERR_CONNECTION_REFUSED
It is behaving simply as I am offline. Even removing these lines of code while I am offline gives me the same result.
Hi,
Please change the GIT Repo link to
**
git clone -b ch02-start https://github.com/TalAter/gotham_imperial_hotel.git
**
The existing repo link is giving error when trying to clone from it
Could you help with this issue?
At the beginnig of the chapter 2,
I have added the following code at the top of js/app.js file:
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("../serviceworker.js")
.then(function(registration) {
console.log("Service Worker registered with scope:", registration.scope);
}).catch(function(err) {
console.log("Service Worker registration failed:", err);
});
}
Then I am simulating an offline state in Chrome (also in Firefox and Safari). I do not see the error message but this one instead:
This site canβt be reached
localhost refused to connect.
Search Google for localhost 8443
ERR_CONNECTION_REFUSED
It is behaving simply as I am offline. Even removing these lines of code while I am offline gives me the same result.
Basicaaly i've juste copied the message here #5 since it seems that the author of this book never read the issues
Many will run into permission issues such as Permission denied (publickey). fatal: Could not read from remote repository.
with the current terminal command.
I recommend offering the HTTPS alternative: git clone -b ch02-start https://github.com/TalAter/gotham_imperial_hotel.git
When I do a hard reset and checkout ch04-start and launch it in Chrome, I get this:
GET https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css net::ERR_INTERNET_DISCONNECTED
GET http://localhost:58410/css/gih-offline.css net::ERR_INTERNET_DISCONNECTED
GET http://localhost:58410/img/logo-header.png net::ERR_INTERNET_DISCONNECTED
It does successfully retrieve in the index-offline.html file but it appears to never run the fetch event for the other files.
Anyone seeing this and have a solution?
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.