This commit is contained in:
zadam
2020-01-24 22:30:17 +01:00
parent 7d9b720ea8
commit 7a62d1636b
18 changed files with 44 additions and 71 deletions

View File

@@ -7,8 +7,10 @@ export default class SpacedUpdate {
}
scheduleUpdate() {
this.changed = true;
setTimeout(() => this.triggerUpdate())
if (!this.changeForbidden) {
this.changed = true;
setTimeout(() => this.triggerUpdate());
}
}
async updateNowIfNecessary() {
@@ -33,4 +35,15 @@ export default class SpacedUpdate {
this.scheduleUpdate();
}
}
allowUpdateWithoutChange(callback) {
this.changeForbidden = true;
try {
callback();
}
finally {
this.changeForbidden = false;
}
}
}