🔧 Test the effect of service worker for sites which want to use.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
htdoc/image
lib
public
.gitignore
.npmignore
CHANGELOG.md
LICENSE
README.md
README_CN.md
index.js
package.json
rules.txt

README.md

Npm Package Npm Downloads node JavaScript Style Guide

whistle.service-worker (中文文档)

As a plugin of whistle, whistle.service-worker tests the effect of service worker for sites which want to use.

Installation

Install packages with npm globally:

$ npm install --global whistle whistle.service-worker

Set proxy to 127.0.0.1:8899. Whistle Doc - Proxy Setting may help.

Example

Suppose to test the effect of service worker for Github Help:

  1. Start whistle:
$ w2 start
  1. Open http://local.whistlejs.com/#rules in browser.

  2. Add following rule to whistle:

help.github.com whistle.service-worker://route=/.*/&strategy=cacheFirst

rule

  1. Open Github Help in new tab and check whether service worker is registered in devtools.

registered

  1. Refresh Github Help and check network pannel in devtools.

fetch

Doc

The key point for users is to set whistle rules like /help.github.com/ whistle.service-worker://route=/.*/&strategy=cacheFirst :

  • help.github.com means the hostname of the site to test.
  • route=/.*/ means to interception request which's url matches RegExp /.*/ by service worker.
  • strategy=cacheFirst is to set a caching strategy. The built-in strategies are:
    • cacheFirst
    • cacheOnly
    • networkFirst
    • networkOnly
    • staleWhileRevalidate

ChangeLog

ChangeLog

Thans List

Licence

MIT