Last active
January 14, 2019 12:09
-
-
Save ylv-io/56bddbf64058d29ec85aee306e4b0664 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
| window.addEventListener('load', () => { | |
| // Checking if Web3 has been injected by the browser (Mist/MetaMask) | |
| if (typeof web3 !== 'undefined') { | |
| // Use Mist/MetaMask's provider | |
| web3js = new Web3(web3.currentProvider); | |
| } else { | |
| console.log('No web3? You should consider trying MetaMask!'); | |
| // fallback - use your fallback strategy (local node / hosted node + in-dapp id mgmt / fail) | |
| web3js = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); | |
| } | |
| // Now you can start your app & access web3 freely: | |
| startApp(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment