Skip to content

Commit

Permalink
validating in state function
Browse files Browse the repository at this point in the history
Making sure UI elements still exists when doing the state function.

Fixing #48
  • Loading branch information
Topener authored Apr 4, 2017
1 parent fc10149 commit 1e35287
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ function mark() {

function state(_state, _message) {

// remove indicator
$.isIndicator.hide();
$.isCenter.remove($.isIndicator);
// remove indicator (validate it still exists)
$.isIndicator && $.isIndicator.hide();
$.isCenter && $.isCenter.remove($.isIndicator);

// set state
if (_state === 0 || _state === false || _state === -1 || _state === 1 || _state === true) {
Expand All @@ -102,8 +102,8 @@ function state(_state, _message) {
_updateMessage(_message);

// add text
$.isCenter.add($.isText);
$.isText.show(); // so it can be hidden on init via TSS
$.isCenter && $.isCenter.add($.isText);
$.isText && $.isText.show(); // so it can be hidden on init via TSS

if (list && _state !== -1) {
mark();
Expand Down

0 comments on commit 1e35287

Please sign in to comment.