Skip to content

Commit

Permalink
docs: add docs for #135
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Feb 7, 2019
1 parent 9e0fde3 commit 6f46667
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/modules/workbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,28 @@ workbox: {
],
}
```

### Hooking on service worker registration life cycle

Create `plugins/sw.js`:

```js
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const worker of registrations) {
console.log('Service worker:', worker)
}
});
}
```

Add it to the `plugins` section of `nuxt.config.js`:

```js
{
plugins: [
src: '~/plugins/sw.js',
ssr: false
]
}
```

0 comments on commit 6f46667

Please sign in to comment.