Removing use of notify to update progress bar
This commit is contained in:
@@ -66,7 +66,6 @@ export default class Node {
|
||||
if (this.state.cancelRender) {
|
||||
deferred.reject('Render cancelled');
|
||||
} else {
|
||||
deferred.notify(1 - this.state.renderCounter / this.state.maxCounter);
|
||||
deferred.resolve.apply(this, result);
|
||||
}
|
||||
}, 1);
|
||||
@@ -99,8 +98,6 @@ export default class Node {
|
||||
|
||||
startRender() {
|
||||
this.state.renderCounter++;
|
||||
|
||||
this.state.maxCounter = Math.max(this.state.maxCounter, this.state.renderCounter);
|
||||
}
|
||||
|
||||
doneRender() {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
export default class ParserState {
|
||||
constructor(progress) {
|
||||
this.groupCounter = 1;
|
||||
this.cancelRender = false;
|
||||
this.warnings = [];
|
||||
this._renderCounter = 0;
|
||||
this._maxCounter = 0;
|
||||
this._progress = progress;
|
||||
}
|
||||
|
||||
get renderCounter() {
|
||||
return this._renderCounter;
|
||||
}
|
||||
|
||||
set renderCounter(value) {
|
||||
if (value > this.renderCounter) {
|
||||
this._maxCounter = value;
|
||||
}
|
||||
|
||||
this._renderCounter = value;
|
||||
|
||||
if (this._maxCounter && !this.cancelRender) {
|
||||
this._progress.style.width = ((1 - this.renderCounter / this._maxCounter) * 100).toFixed(2) + '%';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user