Skip to content

Instantly share code, notes, and snippets.

@neopunisher
Created June 2, 2018 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neopunisher/0cb57cb1f4ce9821d12df333e571b4f3 to your computer and use it in GitHub Desktop.
Save neopunisher/0cb57cb1f4ce9821d12df333e571b4f3 to your computer and use it in GitHub Desktop.
(function(url, inj) {
inj(url).then(function() {
const node = new Ipfs()
node.on('error', errorObject => console.error(errorObject))
node.on('ready', () => {
console.log('nodeready')
node.stop(() => {
console.log('node gone')
})
})
}) })('https://unpkg.com/ipfs/dist/index.min.js', (src, head = true) => new Promise(function(c, d) {
var a = document.createElement("script");
a.src = src;
a.type = "text/javascript";
a.onload = c;
a.onerror = d;
document[head ? 'head' : 'body'].appendChild(a)
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment