Updating progress using the promise notify feature

This commit is contained in:
Jeff Avallone
2014-12-29 17:35:18 -05:00
parent 99c4c078fb
commit e890fe7d2c
4 changed files with 51 additions and 75 deletions
+12 -11
View File
@@ -56,14 +56,9 @@ export default class Regexper {
this.showExpression(this._getHash());
}
updatePercentage(event) {
this.percentage.style.width = event.detail.percentage * 100 + '%';
}
bindListeners() {
this.field.addEventListener('keypress', this.keypressListener.bind(this));
this.form.addEventListener('submit', this.submitListener.bind(this));
this.root.addEventListener('updateStatus', this.updatePercentage.bind(this));
this.root.addEventListener('keyup', this.documentKeypressListener.bind(this));
window.addEventListener('hashchange', this.hashchangeListener.bind(this));
}
@@ -157,12 +152,18 @@ export default class Regexper {
throw message;
})
.invoke('render', this.svgContainer, this.svgBase)
.then(() => {
this.state = 'has-results';
this.updateLinks();
this.displayWarnings(this.runningParser.warnings);
this._trackEvent('visualization', 'complete');
})
.then(
() => {
this.state = 'has-results';
this.updateLinks();
this.displayWarnings(this.runningParser.warnings);
this._trackEvent('visualization', 'complete');
},
null,
percentage => {
this.percentage.style.width = percentage * 100 + '%';
}
)
.then(null, message => {
if (message === 'Render cancelled') {
this._trackEvent('visualization', 'cancelled');