README.md in serviceworker-rails-0.5.1 vs README.md in serviceworker-rails-0.5.2
- old
+ new
@@ -79,10 +79,12 @@
* Adds `serviceworker.js` and `manifest.json` to the list of compiled assets in
`config/initializers/assets.rb`
* Injects tags into the `head` of `app/views/layouts/application.html.erb` for
linking to the web app manifest
+**NOTE** Given that Service Worker operates in a separate browser thread, outside the context of your web pages, you don't want to include `serviceworker.js` script in your `application.js`. So if you have a line like `require_tree .` in your `application.js` file, you'll either need to move your `serviceworker.js` to another location or replace `require_tree` with something more explicit.
+
To learn more about each of the changes or to perform the set up yourself, check
out the manual setup section below.
### Manual setup
@@ -155,11 +157,11 @@
#### Add a manifest
You may also want to create a `manifest.json` file to make your web app installable.
-```
+```javascript
// app/assets/javascripts/manifest.json
{
"name": "My Progressive Rails App",
"short_name": "Progressive",
"start_url": "/"
@@ -222,11 +224,11 @@
if (!request.url.match(/^https?:\/\/example.com/) ) { return; }
if (request.method !== 'GET') { return; }
event.respondWith(
- fetch(request). // first, the network
+ fetch(request) // first, the network
.catch(function fallback() {
caches.match(request).then(function(response) { // then, the cache
response || caches.match("/offline.html"); // then, /offline cache
})
})
@@ -285,10 +287,10 @@
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
## Contributing
-Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/serviceworker-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
+Bug reports and pull requests are welcome on GitHub at https://github.com/rossta/serviceworker-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).