sw-toolbox

WebJar for sw-toolbox

License

License

GroupId

GroupId

org.webjars.bower
ArtifactId

ArtifactId

sw-toolbox
Last Version

Last Version

3.6.1
Release Date

Release Date

Type

Type

jar
Description

Description

sw-toolbox
WebJar for sw-toolbox
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/GoogleChrome/sw-toolbox

Download sw-toolbox

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bower/sw-toolbox/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>sw-toolbox</artifactId>
    <version>3.6.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/sw-toolbox/
implementation 'org.webjars.bower:sw-toolbox:3.6.1'
// https://jarcasting.com/artifacts/org.webjars.bower/sw-toolbox/
implementation ("org.webjars.bower:sw-toolbox:3.6.1")
'org.webjars.bower:sw-toolbox:jar:3.6.1'
<dependency org="org.webjars.bower" name="sw-toolbox" rev="3.6.1">
  <artifact name="sw-toolbox" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='sw-toolbox', version='3.6.1')
)
libraryDependencies += "org.webjars.bower" % "sw-toolbox" % "3.6.1"
[org.webjars.bower/sw-toolbox "3.6.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

⚠️ sw-toolbox ⚠️

sw-toolbox and sw-precache are deprecated in favor of Workbox. Please read this migration guide for information on upgrading.

About

A collection of tools for service workers

Service Worker Toolbox provides some simple helpers for use in creating your own service workers. Specifically, it provides common caching strategies for dynamic content, such as API calls, third-party resources, and large or infrequently used local resources that you don't want precached.

Service Worker Toolbox provides an expressive approach to using those strategies for runtime requests. If you're not sure what service workers are or what they are for, start with the explainer doc.

What if I need precaching as well?

Then you should go check out sw-precache before doing anything else. In addition to precaching static resources, sw-precache supports optional runtime caching through a simple, declarative configuration that incorporates Service Worker Toolbox under the hood.

Install

Service Worker Toolbox is available through Bower, npm or direct from GitHub:

bower install --save sw-toolbox

npm install --save sw-toolbox

git clone https://github.com/GoogleChrome/sw-toolbox.git

Register your service worker

From your registering page, register your service worker in the normal way. For example:

navigator.serviceWorker.register('my-service-worker.js');

As implemented in Chrome 40 or later, a service worker must exist at the root of the scope that you intend it to control, or higher. So if you want all of the pages under /myapp/ to be controlled by the worker, the worker script itself must be served from either / or /myapp/. The default scope is the containing path of the service worker script.

For even lower friction, you can instead include the Service Worker Toolbox companion script in your HTML as shown below. Be aware that this is not customizable. If you need to do anything fancier than register with a default scope, you'll need to use the standard registration.

<script src="/path/to/sw-toolbox/companion.js" data-service-worker="my-service-worker.js"></script>

Add Service Worker Toolbox to your service worker script

In your service worker you just need to use importScripts to load Service Worker Toolbox:

importScripts('bower_components/sw-toolbox/sw-toolbox.js');  // Update path to match your own setup.

Use the toolbox

To understand how to use the toolbox read the Usage and API documentation.

License

Copyright 2015-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.

org.webjars.bower

Versions

Version
3.6.1
3.0.0
2.1.0