Skip to content

cuulee/workbox

 
 

Repository files navigation

Travis Build Status AppVeyor Build status Dependency Status Dev Dependency Status

Welcome to Workbox

Workbox is a suite of helper libraries for service workers and progressive web apps that lets you implement precaching in a manner of minutes. Its features support runtime caching, routing, offline analytics, background syncing, and more.

A service worker in two minutes

Use workbox-cli to add a service worker to an existing project in under two minutes.

A build script in ten minutes

Generate a service worker in your build process using workbox-build.

Much more

Go beyond the basics. If you'd like to use the Workbox libraries, and you already have your own service worker, then checkout workbox-sw which lets you add to what you've already got.

If you've been using Workbox for a while, or you're ambitious, you can delve into its more advanced features. Browse the recipes section, try the examples, or look up something in the mobules reference.

Installing a library

Each library is installed separately using the command line as listed below. To use a particular library:

  1. Install the library. For example:

    npm install --save-dev workbox-sw

  2. Copy the library's JavaScript and map files to your serving directory.

    cp node_modules/workbox-sw/build/* app/

  3. Import the library to your service worker file. For example:

    importScripts('workbox-sw.min.js');

The Libraries

All of the libraries are described below. Each has an About page with basic usage instructions and a Demo directory with an example. The main page of the documentation is here.

workbox-background-sync

Build Status

Queues failed requests and uses the Background Sync API to replay those requests at a later time when the network state has changed.

Install: npm install --save-dev workbox-background-sync

Learn More: AboutDemo Code

workbox-broadcast-cache-update

Build Status

A service worker helper library that uses the Broadcast Channel API to announce when two Response objects differ.

Install: npm install --save-dev workbox-broadcast-cache-update

Learn More: AboutDemo Code

workbox-build

Build Status

This module can be used to generate a file manifest or service worker, that can be used with workbox-sw.

Install: npm install --save-dev workbox-build

Learn More: AboutDemo Code

workbox-cache-expiration

Build Status

Service worker helper library that expires cached responses based on age or maximum number of entries.

Install: npm install --save-dev workbox-cache-expiration

Learn More: AboutDemo Code

workbox-cacheable-response

Build Status

This library takes a Response object and determines whether it's cacheable, based on a specific configuration.

Install: npm install --save-dev workbox-cacheable-response

Learn More: AboutDemo Code

workbox-cli

Build Status

A CLI tool to generate a service worker and a file manifest making use of the workbox-sw module.

Install: npm install --global workbox-cli

workbox-google-analytics

Build Status

A service worker helper library to retry offline Google Analytics requests when a connection is available.

Install: npm install --save-dev workbox-google-analytics

Learn More: AboutDemo Code

workbox-precaching

Build Status

This library is still a work in progress and is not functional.

Install: npm install --save-dev workbox-precaching

Learn More: AboutDemo Code

workbox-routing

Build Status

A service worker helper library to route request URLs to handlers.

Install: npm install --save-dev workbox-routing

Learn More: AboutDemo Code

workbox-runtime-caching

Build Status

A service worker helper library that implements various runtime caching strategies.

Install: npm install --save-dev workbox-runtime-caching

Learn More: AboutDemo Code

workbox-sw

Build Status

A service worker library to make managing fetch requests and caching as easy as possible.

Install: npm install --save-dev workbox-sw

Learn More: AboutDemo Code

workbox-webpack-plugin

Build Status

This is a webpack plugin for workbox-build

Install: npm install --save-dev workbox-webpack-plugin

Learn More: About

External Contributions

Please read the guide to contributing prior to filing any pull requests.

License

Copyright 2016 Google, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Workbox is a collection of JavaScript libraries for Progressive Web Apps

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 96.2%
  • HTML 3.7%
  • Other 0.1%