Closed q3k closed 6 years ago
This shouldn't be in the library probably. I never had to use a timeout or polling when using any kind of web3, either injected or my own. I'd prefer explicit crash with a suggestion that maybe user should wait on window load, and that should be enough
It's not in the library, it's in the frontend code :)
setTimeout() wasn't enough to guarantee consistent loading. In this commit, we make the API.instance() method asynchronous and only return an instance when it's confirmed to be loaded. We also initialize the API instance only on window.load, as per Metamask documentation [1].
[1] - https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md