____  ___    _  _     _   _ _____     _______
 / ___|/ _ \  | || |   | | | |_ _\ \   / / ____|
| |  _| | | | | || |_  | |_| || | \ \ / /|  _|
| |_| | |_| | |__   _| |  _  || |  \ V / | |___
 \____|\___/     |_|   |_| |_|___|  \_/  |_____|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Steemconnect (v3) Bugfix

BY: @mkt | CREATED: June 24, 2019, 8:59 a.m. | VOTES: 56 | PAYOUT: $6.65 | [ VOTE ]

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. :)

TAGS: [ #utopian-io ] [ #development ] [ #busy ] [ #steemconnect ] [ #javascript ]

Replies

@justyy | June 26, 2019, 11:52 p.m. | Votes: 24 | [ VOTE ]

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]

@mkt | June 27, 2019, 5:41 a.m. | Votes: 0 | [ VOTE ]

> 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

@utopian-io | June 29, 2019, 11:55 a.m. | Votes: 0 | [ VOTE ]

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

@steem-ua | June 27, 2019, 12:10 a.m. | Votes: 0 | [ VOTE ]

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

@utopian-io | June 27, 2019, 1:04 p.m. | Votes: 0 | [ VOTE ]

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!

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>