Closed juharris closed 5 years ago
Hi @juharris thanks for the PR. Do you mind detailing to me, in an issue, what exactly is the problem? I would like to make sure I can replicate the bug first before incorporating any changes.
I think it was because I had a bunch of setup logic in my constructor or stuff that needed to run before getWeb3
was called. I probably could refactor but this won't be obvious to everyone so I thought that I should make getWeb3
more robust to handle cases where the event listener for "load" would already be triggered.
I think this is a little out of scope for this project, but we are actually working on this in an upcoming tool. We take the path of checking document.readyState
instead. You can have a look here.
I thank you and appreciate the effort, but I think I will be closing this for now!
Ah that solution looks much better. Thanks for reviewing!
I found that with the current setup web3 wasn't being found in some cases with my app even though this one works fine. I think it's because of the mentioned race condition and the event listener for
"load"
wasn't getting triggered.Sorry Node/JS isn't my main language please let me know if there are style issues and cases I didn't catch.