Coder Social home page Coder Social logo

serviceworker-demo's Introduction

ServiceWorker demo

This is a polyfill for the ServiceWorker specification. The idea is to enable exploration of the ServiceWorker API and the implications it has for users, applications and developer workflow.

NOTE: This may be broken for you. Please submit an issue.

Setup

Requirements

  • Node + npm
  • Chrome Canary

This may only work on OSX. Sorry.

Install

In theory:

$ npm install -g serviceworker && serviceworker

This will start an instance of Chrome Canary and a ServiceWorker proxy server. All requests from Canary will go through the proxy.

Point Canary to a (local) site, add some ServiceWorker stuff and off you go!

If you'd like a site to play with, try using the demo site in the site directory. You'll need to host the files with the domain workerdemo.dev โ€“ try using distra for this.

Architecture

Here's the general idea.

  1. Page requests something
  2. Chrome extension picks up the request and adds an X-Service-Worker-Request-Type header.
  3. Proxy follows the ServiceWorker spec to check if there's a worker registered for the page, and puts request through it.
  4. The worker generates a response or allows the request to go to the network
  5. ServiceWorker server returns response to page

There's also registration, install and activation steps. Check the spec for this.

Notes

  • This stuff (possibly) doesn't play nice with VPNs.
  • No HTTPS

Contributing

Submit an issue or pull request!

serviceworker-demo's People

Contributors

jakearchibald avatar passy avatar

Watchers

Andy Hume avatar James Cloos 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.