2017-06-12 17:24:57 +00:00
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
export default class extends React.PureComponent {
|
2017-06-13 06:14:31 +00:00
|
|
|
componentDidMount () {
|
2017-06-12 17:24:57 +00:00
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
navigator.serviceWorker
|
|
|
|
.register('/service-worker.js')
|
|
|
|
.then(registration => {
|
|
|
|
console.log('service worker registration successful')
|
|
|
|
})
|
|
|
|
.catch(err => {
|
2017-06-13 06:14:31 +00:00
|
|
|
console.warn('service worker registration failed', err.message)
|
2017-06-12 17:24:57 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2017-06-13 06:14:31 +00:00
|
|
|
render () {
|
2017-06-12 17:24:57 +00:00
|
|
|
return (
|
|
|
|
<p>Check the console for the Service Worker registration status.</p>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|