GithubHelp home page GithubHelp logo

hhy5277 / service-workers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zackargyle/service-workers

0.0 2.0 0.0 69 KB

A collection of utilities for creating/testing/experimenting with service workers.

License: MIT License

JavaScript 99.12% HTML 0.88%

service-workers's Introduction

Service Worker Toolchain

Build status

A collection of service worker generation tools. Configurable and forkable.

Includes the following packages

generate-service-worker

A node module for generating service worker files based on provided configuration options.

service-worker-plugin

A webpack plugin for generating dynamic service worker files and a runtime helper.

service-worker-mock

A mock service worker environment generator. Used for testing service worker code.

Why?

There are several other packages that generate service workers (sw-precache, offline-plugin, etc). This collection of tools was built to allow more complexity while being fully testable, and allowing the generation of multiple service worker files simultaneously for experimentation/rollout. We chose not to use a templating language, but to instead inject globals into the scripts so that our "templates" were pure JavaScript. This makes it easier to test/read/update the code, with the downside of slightly larger output sizes. See the README in each package for more details.

We encourage forking of the base templates found in packages/generate-service-worker/templates/.

Contributing

scripts description
yarn install install all dev dependencies
yarn test run the test suite
yarn run lint run eslint
yarn start run the demo for development testing

To get started contributing, run yarn start, which will run a webpack-devserver on localhost:3000. In demo/webpack.config.js you'll see the configurations used for the demo testing. Each experimental config can be accessed via the key query param (i.e. localhost:3000?key=withNotifications). This provides a simple way to install a new service worker for testing, and the corresponding generated code will be visible in the DOM itself thanks to highlight.js. Use the application tab in the devtools to verify that the service worker was installed. By setting debug: true in the plugin config, the devtools console can be used to verify actions are taking place.

Patrons

Be the first to contribute! ✌⊂(✰‿✰)つ✌

Some ideas for contributions:

  • Browserify plugin
  • Rollup plugin

License

MIT

service-workers's People

Contributors

chrislloyd avatar zackargyle avatar

Watchers

 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.