An open API service indexing awesome lists of open source software.

https://github.com/yerkopalma/sw-starter-full

:sparkles: More realistic service worker starter
https://github.com/yerkopalma/sw-starter-full

Last synced: 3 months ago
JSON representation

:sparkles: More realistic service worker starter

Awesome Lists containing this project

README

        

Full service worker starter [![Build Status](https://img.shields.io/travis/YerkoPalma/sw-starter-full/master.svg?style=flat-square)](https://travis-ci.org/YerkoPalma/sw-starter-full)
===========================

> More realistic service worker starter

Check here: https://sw-starter-full.surge.sh

## Overview

This is some sort of a second part of my simple [sw-starter](https://github.com/YerkoPalma/sw-starter). The main differences here are:

- No `localStorage`, instead [`Dexie.js`](https://github.com/dfahlander/Dexie.js) is used
- The service-worker is now generated with [`sw-precache`](https://github.com/GoogleChrome/sw-precache)
- The _offline first_ strategy is a bit improved

## Knowledge

- `sw-precache` only cache the assets of the proyect, and to cache the data, ~~should use different _fetch_ handler~~ use only the local database.
- In the `sw-precache` should be included specificly the files to cache to ignore junk files.
- Firebase use only Objects, no arrays, so, some hack need to be done to properly handle data.
- Local data should never replace network data, so `xhr` should always be done.
- HTTPS can be a pain. I found the best way to work for SPA is, develop on the cloud (I used c9.io) and deploy to third party service (I used surge.sh).

## See also

- [Getting started with PWAs](https://addyosmani.com/blog/getting-started-with-progressive-web-apps/)
- [Storage on the web](https://github.com/addyosmani/storage-on-the-web)
- [Your first PWA](https://developers.google.com/web/fundamentals/getting-started/your-first-progressive-web-app/?hl=en)
- [Firebase REST API](https://www.firebase.com/docs/rest/api/)
- [Dexie.js offline sample](https://github.com/matthew-andrews/offline-todo-dexie/blob/gh-pages/application.js)

## License

MIT © [YerkoPalma](https://github.com/YerkoPalma)