Giter Site home page Giter Site logo

sw-test's Introduction

serviceWorker demo

Use these for debugging:

  • chrome://inspect/#service-workers
  • chrome://serviceworker-internals/

If you shift+reload a document it will always load without a controller.

How do I update the service worker

Change the service worker file, and make sure to update the cache key (the cache version).

  • Close & reopen the tab, or shift+reload then normal reload

What's the deal with self?

self is a reference to ServiceWorkerGlobalScope. MDN

things to do

DRY way to keep track of static assets to pre-fetch. Our install event might fetch things like this:

cache.addAll([
  '/contact'
]);
return cache.addAll([
  '/',
  '/style.css',
  '/assets/img/bg-bah.png',
  '/assets/img/circle.svg',
  '/assets/img/triangle.svg'
]);

Tool to make a list of requests?

Check out sw-precache — a build tool that generates sw and asset list. You can use globs since it runs in gulp.

  • automatically versions cached assets using a hash of the content
  • knows which caches have expired

Research

sw-test's People

Contributors

nichoth avatar

Watchers

James Cloos avatar  avatar  avatar

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.