Skip to content

Commit

Permalink
perf: prevent duplicate allDone getter calls
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Mar 20, 2019
1 parent 1289e1e commit 0cb31cd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class LoadingUI {
this.serveWS = this.serveWS.bind(this)

this._lastBroadCast = 0
this.allDone = true
}

async init() {
Expand Down Expand Up @@ -39,12 +40,9 @@ class LoadingUI {
}
}

get allDone() {
return this.states.every(state => state.progress === 0 || state.progress === 100)
}

setStates(states) {
this.states = states
this.allDone = this.states.every(state => state.progress === 0 || state.progress === 100)
this.broadcastState()
}

Expand Down

0 comments on commit 0cb31cd

Please sign in to comment.