Created
June 14, 2018 06:42
-
-
Save carsonfarmer/cfb1618e7f8bb46460b6c6f658e509fc to your computer and use it in GitHub Desktop.
main.js step 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'babel-polyfill' // We need this for async/await polyfills | |
// Import our two IPFS-based modules | |
import getIpfs from 'window.ipfs-fallback' | |
import crypto from 'libp2p-crypto' | |
let ipfs | |
// Setup a very simple async setup function to run on page load | |
const setup = async () => { | |
try { | |
ipfs = await getIpfs() // Init an IPFS peer node | |
const id = await ipfs.id() // Get the peer id info | |
console.log(`running ${id.agentVersion} with ID ${id.id}`) | |
} catch(err) { | |
console.log(err) // Just pass along the error | |
} | |
} | |
setup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment