This repository has been archived on 2023-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
2017-12-06 06:09:58 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const IPFS = require('ipfs')
|
|
|
|
|
2017-12-17 05:34:40 +00:00
|
|
|
|
2017-12-06 06:09:58 +00:00
|
|
|
function App() {
|
|
|
|
let node
|
|
|
|
|
|
|
|
create()
|
|
|
|
|
2017-12-10 07:06:25 +00:00
|
|
|
function create() {
|
2017-12-21 05:21:49 +00:00
|
|
|
if ('serviceWorker' in navigator) {
|
|
|
|
navigator.serviceWorker.register('/fetcher.js')
|
|
|
|
.then((registration) => {
|
2017-12-23 05:42:13 +00:00
|
|
|
console.log('registered the service worker successfully')
|
2017-12-21 07:14:51 +00:00
|
|
|
|
|
|
|
// Now that a service worker is registered to intercept URLs, reload the page so
|
|
|
|
// this page's URL gets loaded from IPFS by the service worker.
|
|
|
|
window.location.reload(false)
|
2017-12-10 07:06:25 +00:00
|
|
|
})
|
2017-12-21 05:21:49 +00:00
|
|
|
.catch((err) => {
|
2017-12-23 05:42:13 +00:00
|
|
|
console.log('failed to register the service worker:', err)
|
2017-12-21 05:21:49 +00:00
|
|
|
})
|
|
|
|
}
|
2017-12-06 06:09:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = App
|
|
|
|
|
|
|
|
App()
|