Giter VIP home page Giter VIP logo

pwa-training-labs's Introduction

PWA Training Labs

This repo contains open-source training labs for building Progressive Web Apps.

Getting started

The instructions for this course currently exist as a series of Codelabs. There are also corresponding video lessons for each section.

Contributing

If you find a bug or think something could be better, please file an issue!

  • If you think a code change should be made, feel free to file a PR.
  • If you think the instructions should be updated, please file a bug instead of a PR. The instructions for this project are generated from internal documents, so we can't use PRs to update them.

Note

This is not an official Google product.

pwa-training-labs's People

Contributors

bochap avatar davidscales avatar dependabot[bot] avatar glennsimon avatar msteitle avatar naokigoogle avatar nasearle avatar osrecio avatar penance316 avatar samdutton avatar shadeb 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  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

pwa-training-labs's Issues

QUnit Example error

In fetch-api-lab/app/test/test.html Line:71 error is a string so

assert.ok(error.message.indexOf('File not found'),
          'bad responses throw error that contains response.statusText');

is a TypeError is it cannot read property indexOf of undefined which is breaking all subsequent tests.

Removing message.indexOf from the assert.ok prevents the error.

Gulp install for Course 4.1

In Course 4.1, Step 6, Process Javascript
When we need to install the gulp-babel.
The command is given as
npm install --save-dev gulp-babel babel-core babel-preset-env

But there is a warning given when installing
"[email protected] requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourself. "
And this would prevent our "gulp processJs" work.
We would get error: "Error: Cannot find module '@babel/core'"

In order to fix the error, we need to install the babel-core and babel-preset-env as peer dependencies with the command:
npm install --save-dev @babel/core

Corresponding issue in Gulp-Babel

Documentation

I feel the readme folder is not detailed enough for those that want to contribute to Open Source for the first time. So, I want to add ways to contribute. Thank you

cannot get started

cd offline-quickstart-lab/app
npm install
node server.js
Error: Cannot find module '.../PWA/pwa-training-labs/server.js'
node -v
v11.10.0

Update service workers' update instructions

Summary

In the current version of Chrome: 76.0 users the developer can choose to update service worker file after a reload with that in mind it would be nice to update the instructions for updating the service workers' file.

Screenshot

Screenshot from 2019-08-11 16-11-18

Proposed update

Screenshot from 2019-08-11 16-18-50

Incorrect promise logic

https://developers.google.com/web/ilt/pwa/caching-files-with-service-worker#serving_files_from_the_cache

Cache then network example.

var networkDataReceived = false;

startSpinner();

// fetch fresh data
var networkUpdate = fetch('/data.json').then(function(response) {
  return response.json();
}).then(function(data) {
  networkDataReceived = true;
  updatePage(data);
});

// fetch cached data
caches.match('/data.json').then(function(response) {
  if (!response) throw Error("No data");
  return response.json();
}).then(function(data) {
  // don't overwrite newer network data
  if (!networkDataReceived) {
    updatePage(data);
  }
})
.catch(function() {
  // we didn't get cached data, the network is our last hope:
  return networkUpdate;
})
.catch(showErrorMessage) // never called, because previous catch swallows thrown error
.then(stopSpinner()); // stopSpinner called immediately, should be `then(stopSpinner)`.

See comments for last 2 lines of above snippet

If there is better place to report this problem, please let me know. I'll move it.

Missing files

The instructions (progressive-web-apps-ilt-codelabs.pdf) for service-worker-lab mention navigating to app/test/test-registered.html but this doesn't seem to exist.

Same problem with cache-api-lab

flagChain test failing on MacOS

Hi,

I was working on the lab exercises for Developing Progressive Web Apps 03.1: Promises
on MacOS (High Sierra, version: 10.13.6). It appears that the following test will fail on MacOS

    QUnit.test('flagChain (finished in section 3)', (assert) => {
      const done = assert.async();
      app.flagChain('invalid input')
      .then(r => {
        const domImages = document.getElementsByTagName('img');
        assert.ok(domImages.length > 0, 'appends image to DOM');
        done();
      }).catch(e => {
        assert.ok(false, 'catches rejections');
        done();
      });
    });

I suspect that the reason was due to the fallback function returning the following in lowercase

  function fallbackName() {
    return 'chile.png';
  }

but the images in the test folder are in uppercase
Screen Shot 2019-08-28 at 4 06 34 PM

This causes Express to be unable to locate the file since the Fetch API call will pass imageName which is from fallbackName.

  function fetchFlag(imageName) {
    return fetch('flags/' + imageName); // fetch returns a promise
  }

This might be OS related as I was not able to test on Windows or Linux. Will it be a good idea to rename the files in the Test folder to be lowercase. I could get the test to pass by doing that. And it keeps the names consistent with those in the /app/flags folder as well. I will be happy to create the PR if this is the accepted solution

QUnit Test Error

Working with IndexedDB lab:

Uncaught TypeError: indexedDB.webkitGetDatabaseNames is not a function
Source: /indexed-db-lab/app/test/test.html:48

function checkDb() { var dbExists = false; // Webkit only works in Chrome return promisifyRequest(indexedDB.webkitGetDatabaseNames())

indexedDB.webkitGetDatabaseNames() is a deprecated feature
https://www.chromestatus.com/features/5725741740195840

Corrupted Content Error on localhost:8080/

Good morning,

I just started taking the Developing Progressive Web Apps training course; On runnng the command http-server -p 8080 -a localhost -c 0 inside the responsive-design-lab/app/ I got this error: Corrupted Content Error: The site at http://localhost:8080/ has experienced a network protocol violation that cannot be repaired.. I've cleared the site data and unregistered all serivce workers buit the error still persist.
Please advise on a forward in resolving it.

Thank you.

Issue in IndexedDB course

In section 3.3 Add objects to the object store, when I press the Add products button, the items didn't save in the IndexedDB and comes error in my console like picture below.
image

In IndexedDB > couches-n-things > products:
empty products

I hope this issue can be solved ASAP. Thanks a lot team.

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.