-
Notifications
You must be signed in to change notification settings - Fork 540
Conversation
elStopButtons.forEach(el => { | ||
const elStopButton = el; | ||
elStopButton.style.display = null; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-binary you copy this code almost 4 times. can it all goes in some "setBotButtonsVisibility` or st like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of the blocks does different things, e.g. in one case the block will just be hidden, in another, the block will be hidden and disabled, and in the other, the block is just disabled.
if (error.error && error.error.error.code === 'InvalidToken') { | ||
removeAllTokens(); | ||
updateTokenList(); | ||
this.stop(); | ||
} | ||
}); | ||
|
||
globalObserver.register('bot.running', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-binary does this globalObserver
have something like reaction
so it listen to state changes and when ever bot state change to running or not running , disable and enable the buttons
once only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Through the observer you can observer.register('name')
to a named event, once that event is emitted (through observer.emit('name')
) the callback will be executed. In some cases, the buttons should not be enabled when the bot is not running, e.g. when the user is fetching contracts_for
from the API.
No description provided.