GithubHelp home page GithubHelp logo

talater / gotham_imperial_hotel Goto Github PK

View Code? Open in Web Editor NEW
187.0 187.0 109.0 1.33 MB

πŸ“˜ Code for Building Progressive Web Apps book

Home Page: https://pwabook.com/

License: MIT License

JavaScript 52.16% CSS 17.60% HTML 30.24%

gotham_imperial_hotel's People

Contributors

anthonyalvarez avatar dependabot[bot] avatar talater avatar wilsonandusa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gotham_imperial_hotel's Issues

Silly question

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

ch11 - fetch "events.json" resolves even in offline mode

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);
    });
  })
);

"Service worker registration failed" error message does not show

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.

Offline mode doesn't work

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

GIT clone over HTTPS is better

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

Ch03/04 code not working

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.