README.md in serviceworker-rails-0.5.4 vs README.md in serviceworker-rails-0.5.5

- old
+ new

@@ -1,10 +1,9 @@ # ServiceWorker::Rails [![Build Status](https://travis-ci.org/rossta/serviceworker-rails.svg?branch=master)](https://travis-ci.org/rossta/serviceworker-rails) [![Code Climate](https://codeclimate.com/github/rossta/serviceworker-rails/badges/gpa.svg)](https://codeclimate.com/github/rossta/serviceworker-rails) -[![Coverage Status](https://coveralls.io/repos/github/rossta/serviceworker-rails/badge.svg?branch=master)](https://coveralls.io/github/rossta/serviceworker-rails?branch=master) Turn your Rails app into a Progressive Web App. Use [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) with the Rails asset pipeline. ## Why? @@ -98,13 +97,15 @@ ```javascript // app/assets/javascripts/serviceworker.js.erb console.log('[Service Worker] Hello world!'); +var CACHE_NAME = 'v1-cached-assets' + function onInstall(event) { event.waitUntil( - caches.open('cached-assets-v1').then(function prefill(cache) { + caches.open(CACHE_NAME).then(function prefill(cache) { return cache.addAll([ '<%= asset_path "application.js" %>', '<%= asset_path "application.css" %>', '/offline.html', // you get the idea ... @@ -237,10 +238,10 @@ ); // See https://jakearchibald.com/2014/offline-cookbook/#on-network-response for more examples } -self.addEventListener('install', onInstall); +self.addEventListener('fetch', onFetch); ``` ## Configuration When `serviceworker-rails` is required in your Gemfile, it will insert a middleware into the Rails