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.
intergalactic/src/index.js

33 lines
832 B
JavaScript

'use strict'
const IPFS = require('ipfs')
function App() {
let node
create()
function create() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/ipfs/fetcher.js')
.then((registration) => {
console.log('registered the service worker successfully')
// 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.
if (window.location.pathname.startsWith('/ipfs/')) {
window.location.reload(false)
}
})
.catch((err) => {
console.log('failed to register the service worker:', err)
})
}
}
}
module.exports = App
App()