Steemconnect (v3) Bugfix

in #utopian-io6 years ago (edited)

Pull request:
https://github.com/steemscript/steemconnect.js/pull/68

I was working on a node.js backend when I ran into the following issue with the comment and vote function of Steemconnect:

window is not defined                                                                                                                                          21:37:25

  at hasChromeExtension (node_modules/steemconnect/lib/index.js:43:3)
  at useSteemKeychain (node_modules/steemconnect/lib/index.js:49:11)
  at Client.vote (node_modules/steemconnect/lib/index.js:201:11)
  at steemconnectClient.me (api/index.js:104:34)
  at node_modules/steemconnect/lib/index.js:179:16
  at process._tickCallback (internal/process/next_tick.js:68:7)

I thought window && ... should be fine but apparently it was not. This lead me to the solution:
https://stackoverflow.com/questions/4186906/check-if-object-exists-in-javascript

So now Steemconnect (3.0.1) works with Node.js as intended: SteemConnect.js was designed to work both in the browser and in Node.js.

Thank you @fabien for taking action so quickly and releasing a new version. I can continue with my project now, which will be announced soon. :)

Sort:  

Thank you for your contribution. I think it is better to use "!==" instead of "!=" as a good coding style.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

I think it is better to use "!==" instead of "!=" as a good coding style.

I absolutely agree. Thanks! I'm working with Go these days at work. Maybe that's why I forgot. :D

Thank you for your review, @justyy! Keep up the good work!

Hi @mkt!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @mkt!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.23
TRX 0.26
JST 0.040
BTC 98004.63
ETH 3487.60
USDT 1.00
SBD 3.26