Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 50a330b

Browse files
author
Lucas Alvarez
committed
Add an index file with all the SW and the descriptions. We add too a method to handle and retrieve this descriptions.
1 parent fa23334 commit 50a330b

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"serviceworkers":[
3+
{
4+
"id": 1,
5+
"description": "This simple but elegant solution pulls a file from your web server called \"offline.html\" (make sure that file is actually there) and serves the file whenever a network connection can not be made.",
6+
"title": "Offline page"
7+
},
8+
{
9+
"id": 2,
10+
"description": "A solution that expands the offline capabilities of your app. A copy of each pages is stored in the cache as your visitors view them. This allows a visitor to load any previously viewed page while they are offline.",
11+
"title": "Offline copy of pages"
12+
},
13+
{
14+
"id": 3,
15+
"description": "A copy of each pages is stored in the cache as your visitors view them. This allows a visitor to load any previously viewed page while they are offline. This then adds the \"offline page\" that allows you to customize the message and experience if the app is offline, and the page is not in the cache.",
16+
"title": "Offline copy with Backup offline page"
17+
},
18+
{
19+
"id": 4,
20+
"description": "Use this service worker to pre-cache content. The content you add to the \"cache-array\" will be added immediately to the cache and service from the cache whenever a page requests it. At the same time it will update the cache with the version you have on the server. Configure your file array to include all your site files, or a subset that you want to be served quickly.",
21+
"title": "Cache-first network"
22+
},
23+
{
24+
"id": 5,
25+
"description": "Use this service worker to improve the performance of your app, and make it work offline. The advanced pre-cache allows you to configure files and routes that are cached in different manners (pre-cache, server first, cache first etc). The tool can be used to build a lightening fast app (even for dynamic content) that works offline.",
26+
"title": "Advanced Pre-cache"
27+
}
28+
]
29+
}

lib/serviceWorkerTools.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ function getAssetsFolders(ids, callback) {
2020
return Q.resolve(results).nodeify(callback);
2121
}
2222

23+
function getServiceWorkersDescription(callback) {
24+
var relativeDir = '../assets/serviceworkers'
25+
26+
var result = path.resolve(__dirname, relativeDir) + '/serviceworkers.json';
27+
28+
return Q.resolve(result).nodeify(callback);
29+
}
30+
2331
function getServiceWorkersFromUrl (siteUrl, callback) {
2432
var deferred = Q.defer();
2533
request({ uri: siteUrl }, function (err, response, body) {

0 commit comments

Comments
 (0)