Component saving timeouts

This commit is contained in:
Mo Bitar
2017-11-13 12:20:30 -06:00
parent 909d66067b
commit 0df6c2a412

View File

@@ -382,12 +382,19 @@ angular.module('app.frontend')
else if(action === "save-items" || action === "save-success" || action == "save-error") { else if(action === "save-items" || action === "save-success" || action == "save-error") {
if(data.items.map((item) => {return item.uuid}).includes(this.note.uuid)) { if(data.items.map((item) => {return item.uuid}).includes(this.note.uuid)) {
if(action == "save-items") { if(action == "save-items") {
this.showSavingStatus(); if(this.componentSaveTimeout) $timeout.cancel(this.componentSaveTimeout);
} else if(action == "save-success") { this.componentSaveTimeout = $timeout(this.showSavingStatus.bind(this), 10);
$timeout(this.showAllChangesSavedStatus.bind(this), 200); }
} else {
$timeout(this.showErrorStatus.bind(this), 200); else {
if(this.componentStatusTimeout) $timeout.cancel(this.componentStatusTimeout);
if(action == "save-success") {
this.componentStatusTimeout = $timeout(this.showAllChangesSavedStatus.bind(this), 400);
} else {
this.componentStatusTimeout = $timeout(this.showErrorStatus.bind(this), 400);
}
} }
} }
} }