Created
June 5, 2017 22:35
-
-
Save TravisMullen/02a7256fd3d1eaca710e8c98624fe5ac to your computer and use it in GitHub Desktop.
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
function loadWeb3 () { | |
let web3Injected = window.web3; | |
if(typeof web3Injected !== 'undefined'){ | |
// detect MetaMask.io | |
web3 = new Web3(web3Injected.currentProvider) | |
} else { | |
// eth node | |
web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment