Skip to content
A service worker implementation of the behavior defined in a page's AppCache manifest.
Branch: master
Clone or download
Latest commit a65710f Jun 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Squashed commits Mar 27, 2019
packages Added files field Jun 21, 2019
tests Add new Travis config (#2) Jun 20, 2019
.eslintrc.js Squashed commits Mar 27, 2019
.gitignore Squashed commits Mar 27, 2019
.travis.yml Add new Travis config (#2) Jun 20, 2019
LICENSE Squashed commits Mar 27, 2019
README.md Added READMEs Jun 19, 2019
lerna.json v0.1.0 Jun 21, 2019
package-lock.json Update deps. Jun 21, 2019
package.json Update deps. Jun 21, 2019

README.md

About

A pair of modules meant to ease the transition off of AppCache and on to service workers.

Installation

There are two modules to install: one that is used from within the window context in your web app, and the other that's used in the context of your service worker.

npm install --save-dev appcache-polyfill-window
npm install --save-dev appcache-polyfill-sw

Usage

Window client

<script type="module">
  import {init} from '/path/to/appcache-polyfill-window/build/index.mjs';
  init().then(() => navigator.serviceWorker.register('sw.js'));
</script>

Service worker client

importScripts('/path/to/appcache-polyfill-sw/build/index.umd.js');

self.addEventListener('fetch', (event) => {
  // Alternatively, examine event.request and only use the appcachePolyfill.handle()
  // logic for a subset of requests.
  event.respondWith(appcachePolyfill.handle(event));
});

Feedback

This project is still a work in progress. Please experiment with it on a non-production version of your site, and open issues with feedback or bug reports if you run in to problems.

You can’t perform that action at this time.