Skip to content

Conversation

wahibhaq
Copy link
Contributor

@wahibhaq wahibhaq commented Feb 9, 2018

I asked Rishat who is joining as our frontend lead engineer next month. He shared the updated code with me and I just replaced it in the app.js.

I think if we are publishing it to the world then it makes sense to ask for feedback and show the best version of our code :)

His comment and I am quoting:

Why return 'success' tho? It doesn’t really mean success, and it returns before the asynchronous call finishes execution. May be a source of trouble even.

Please test it first in production and see if there are no newly introduced bugs. If looks better than your code then I would say include this in the medium post and also a good learning for you then.

@wahibhaq wahibhaq added the enhancement New feature or request label Feb 9, 2018
@wahibhaq wahibhaq requested a review from rayoriz February 9, 2018 09:05
console.log('open called');
gpio.open(pin, 'output', (err) => { // Open pin 11 for output
gpio.write(pin, 1, () => { // Set pin 11 high (1)
setTimeout(=> () {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setTimeout(=> () { seems like there's a syntax error here. Should have been like setTimeout( () => {

var relayOpen = false;
let relayOpen = false; // A global flag for relay
var openTime = 2000;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might consider var pin = 11 and var openTime = 2000 can be const instead of var if they're not gonna change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants