Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service worker #95

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dfabulich
Copy link
Contributor

@dfabulich dfabulich commented Nov 30, 2021

Reopening PR #87, which was closed in the big dist refactor.

Fixes #6

To test it, edit index.html and set useServiceWorker = true. Then, use the Application tab in Chrome to see the service worker register. You can then check the "Offline" button and refresh to see it working offline.

Note that as of right now, the master branch isn't very useful offline, but if you include my fix for #80, users could go to iplayif.com, click the browser's "install" button to install it locally, and use that to play locally downloaded games offline.

Also note that we're dropping serviceworker.js in the same directory as the index.html file, aka the root directory, because otherwise it doesn't work.

To learn about service workers:

  1. Do Google's free Udacity web course. (You can skip the last bit about IndexedDB.) https://www.udacity.com/course/offline-web-applications--ud899
  2. Read my blog post https://redfin.engineering/service-workers-break-the-browsers-refresh-button-by-default-here-s-why-56f9417694 (linked above) and its corresponding part 2 https://redfin.engineering/how-to-fix-the-refresh-button-when-using-service-workers-a8e27af6df68
  3. Rewrite my service worker code from scratch, fixing bugs as you go (and feel free to ask me anything you like). It's only a few dozen lines, but there are a lot of weird failure cases (which you'll encounter while working on the Udacity course); by the time you could write this PR yourself, you'll be ready to merge it.

@curiousdannii curiousdannii force-pushed the master branch 5 times, most recently from 97d0343 to fa90eaf Compare January 19, 2022 02:01
@curiousdannii
Copy link
Owner

The server migration seems to have gone ahead successfully, so I'll start moving on this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support service workers
2 participants