Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
README cleanup for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Dec 8, 2015
1 parent 452754d commit f6c7adc
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 45 deletions.
6 changes: 4 additions & 2 deletions _recipe_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Use Case
(Summary)

## Features and usage
## Features and Usage

-
-
Expand All @@ -21,5 +21,7 @@ Tests have been run in:
-

## Solution
(Add details here)


## Category
(General Usage|More than Offline|Offline|Web Push)
13 changes: 13 additions & 0 deletions _recipe_template/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// [Working example](/serviceworker-cookbook/DIR-HERE/).

self.addEventListener('install', function() {

});

self.addEventListener('fetch', function() {

});

self.addEventListener('activate', function() {

});
6 changes: 3 additions & 3 deletions api-analytics/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# API analytics
# API Analytics

Perform API usage logging without interfering with the UI layer by adding a service worker to gather the usage and use the sync API to upload gathered data from time to time.

## Difficulty
Intermediate

## Use case
## Use Case
As a web app developer, I want to add API tracking capabilities to my web application trying to not modify client code nor server code at all.

## Solution
With the use of a service worker, we intercept each request of a client and send some information to a log API.

## Category
More than offline
More than Offline
4 changes: 2 additions & 2 deletions cache-from-zip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This recipe illustrates how to cache contents from a zipfile.
## Difficulty
Intermediate

## Use case
## Use Case
As a web developer I want to distribute my applications as individual zipped packages, so that I can reduce the number of HTTP requests and provide an implicit way of listing all the resources to offline.

## Solution
While installing the SW, download the zipfile and decompress, caching each of resources.

## Category
More than offline
More than Offline
4 changes: 2 additions & 2 deletions cache-then-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ This recipe illustrates methods to return network requests from either the cache
## Difficulty
Beginner

## Use case
## Use Case
One advantage to using service workers is having programmatic control over what you return from cache and what you prefer to load from server. This example provides you a front-end to experiment with that choice.

## Features and usage
## Features and Usage

- Configure form to allow or disallow cache and/or network
- Click "Get new data" to execute requests
Expand Down
6 changes: 3 additions & 3 deletions dependency-injector/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Dependency injection
# Dependency Injection
This recipe shows how a Service Worker can act as a dependency injector, avoiding _hard wiring_ dependencies for high level components.

## Difficulty
Advanced

## Use case
## Use Case
As a framework developer, I want to provide production and testing environments, configuring two different injectors to provide the proper mock ups for the components without altering client code.

## Solution
Expand All @@ -15,4 +15,4 @@ Start by looking at `bootstrap.js` to see how a framework could detect which inj
Compare the actual and mocked implementation of the `dialogs` interface in `actual-dialogs.js` and `mock-dialogs.js`.

## Category
More than offline
More than Offline
10 changes: 5 additions & 5 deletions fetching/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Fetching remote resources
# Fetching Remote Resources

This recipe shows 2 standard ways of loading a remote resource and one way to use service worker as a proxy middleware.

There are used 3 types of remote resources - unsecure (http), secured with allow-origin header, and secured without the header.
There are used 3 types of remote resources - unsecure (http), secured with `allow-origin` header, and secured without the header.

## DOM Element
DOM elements are loading the resources

## Fetch
Fetch issues a cors or no-cors request to each resource

## Fetch with SW proxy
Fetch on the client loads a local resource ./cookbook-proxy/{full URL} which is then translated to real URL in the service worker and forwarded to the client.
## Fetch with Service Worker Proxy
Fetch on the client loads a local resource `./cookbook-proxy/{full URL}` which is then translated to real URL in the service worker and forwarded to the client.

## Difficulty
Intermediate

## Category
General usage
General Usage
6 changes: 3 additions & 3 deletions immediate-claim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ This recipe shows how to have the service worker immediately take control of the
## Difficulty
Beginner

## Use case
## Use Case
Basic service worker registration requires a navigation event to occur before the service worker starts working. This recipe illustrates a trick you can use for the service worker to immediately start working upon install.

## Features and usage
## Features and Usage

- Register a service worker
- Delete old cache if present
- Immediately claim the service worker

## Category
General usage
General Usage
4 changes: 2 additions & 2 deletions json-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ This recipe illustrates fetching a JSON file during service worker installation
## Difficulty
Beginner

## Use case
## Use Case
You may not always want to keep the array of files to cache in the service worker's `.js` file itself -- you may want to hold that information in another place, possibly for versioning purposes.

## Features and usage
## Features and Usage

- Register a service worker
- Service worker retrieves a JSON file listing important resources to be cached
Expand Down
8 changes: 4 additions & 4 deletions live-flowchart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Security error

![Screenshot](https://raw.githubusercontent.com/franciov/serviceworker-cookbook/recipe/live-flowchart/live-flowchart/security-error.png)

## Features and usage
## Features and Usage

Features are:

Expand All @@ -40,7 +40,7 @@ Usage:
- take actions in case (e.g. open about://serviceworkers)
- hack the code and see what happens

## How to read the logs
## How to Read the Logs

There are two logs to read:

Expand Down Expand Up @@ -74,7 +74,7 @@ Notes:

- the browser has to support ES6

## What's next / contributions
## What's Next / Contributions

- responsive to work on mobile
- have the flowchart build in SVG and visualize the service worker states
Expand All @@ -87,4 +87,4 @@ Notes:
- provide a button to simulate the lie-fi network status (very low connectivity but not completely offline)

## Category
General usage
General Usage
6 changes: 3 additions & 3 deletions message-relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ This recipe shows how to communicate between the service worker and a page and s
## Difficulty
Beginner

## Use case
## Use Case
The `postMessage` API is brilliant for passing messages between windows and `iframe`s, and now we can use the service worker's `message` event to act as a messenger.

## Features and usage
## Features and Usage

- postMessage API
- Service worker registration

## Category
General usage
General Usage
4 changes: 2 additions & 2 deletions offline-fallback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This recipe shows how to serve content from the cache when the user is offline.
## Difficulty
Beginner

## Use case
## Use Case
There's a problem with relying on the browser's default "you are offline" message:

- The screen isn't branded the same as your app
Expand All @@ -14,7 +14,7 @@ There's a problem with relying on the browser's default "you are offline" messag

A better solution would be to show the user a custom offline snippet served from the cache.

## Features and usage
## Features and Usage

- Register a service worker
- Cache an `offline.html` file
Expand Down
4 changes: 2 additions & 2 deletions offline-status/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ This basic recipe illustrates caching critical resources for offline use and the
## Difficulty
Beginner

## Use case
## Use Case
The most basic of service worker use cases: caching a set of files so that the user may go offline. The added value in this demo is showing a notification to the user that they can safely go offline.

## Features and usage
## Features and Usage

- Register a service worker
- Monitor the cached status of required resources
Expand Down
8 changes: 4 additions & 4 deletions push-subscription-management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ This recipe shows how to use push notifications with subscription management.
## Difficulty
Advanced

## Use case
## Use Case
Allowing users to subscribe to features of your app allows you to keep in touch with and convert visitors!


Init state
Init State
----------
After service worker is registered, client is checking if it is already subscribed to the notificiation service. Button's contents is set depending on this.

Expand All @@ -26,11 +26,11 @@ Unsubscribe
-----------
After successful unsubscription (index.js::pushSubscription.unsubscribe) client sends a post request to application server to unregister the subscription. Server is no longer sending notification.

Subscription expired
Subscription Expired
--------------------
Service worker is watching for the *pushsubscriptionchange* event and resubscribes to the push service.

Not in recipe
Not in Recipe
-------------
Subscription might be cancelled by the user outside of this page (from browser settings or notification UI). In this recipe server will stop to send the notifications, but the front-end doesn't know about it. One could periodically check if registration is still active.

Expand Down
6 changes: 3 additions & 3 deletions render-store/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Render store
# Render Store
The recipe demonstrates one recommendation from the [NGA](https://wiki.mozilla.org/Gaia/Architecture_Proposal#Render_store). A cache containing the interpolated templates in order to avoid model fetching and render times upon successive requests.

## Difficulty
Intermediate

## Use case
## Use Case
As a web app developer, I want to minimize the load time for revisited resources.

## Solution
Use an offline cache to store the template once it's completely rendered and use this copy upon next requests.

## Category
More than offline
More than Offline
4 changes: 2 additions & 2 deletions request-deferrer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This recipe shows how to enqueue requests while in offline in an _outbox-like_ b
## Difficulty
Advanced

## Use case
## Use Case
As a modern framework developer, I want to provide an agnostic way of handling requests while offline.

## Solution
Expand All @@ -15,4 +15,4 @@ This advanced technique is intended to integrate with REST APIs and it requires
The solution is a proof of concept and does not include error handling which is a real challenge in this implementation. Some of the problems are stated in the inlined documentation.

## Category
More than offline
More than Offline
6 changes: 3 additions & 3 deletions virtual-server/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Virtual server
# Virtual Server
This recipe shows a service worker acting like a remote server.

## Difficulty
Intermediate

## Use case
## Use Case
As an application developer, I want to to fully decouple UI from business logic.

## Solution
Expand All @@ -15,4 +15,4 @@ Instead of implementing your own logic to distinguish between routes and request
The client code is virtually identical to [that in the API analytics recipe](/api-analytics_index_doc.html) (the report link has been removed). On the contrary, the [remote _Express server_](/api-analytics_server_doc.html) has been completely replaced by the _[ServiceWorkerWare](https://github.com/gaia-components/serviceworkerware) worker_.

## Category
More than offline
More than Offline

0 comments on commit f6c7adc

Please sign in to comment.