mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Clear outstanding alerts when synchronisation is restored
This commit is contained in:
parent
a4b8551e00
commit
9f5c0de078
@ -190,7 +190,11 @@ Update the document body with the class "tc-dirty" if the wiki has unsaved/unsyn
|
|||||||
*/
|
*/
|
||||||
Syncer.prototype.updateDirtyStatus = function() {
|
Syncer.prototype.updateDirtyStatus = function() {
|
||||||
if($tw.browser && !this.disableUI) {
|
if($tw.browser && !this.disableUI) {
|
||||||
$tw.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
|
var dirty = this.isDirty();
|
||||||
|
$tw.utils.toggleClass(document.body,"tc-dirty",dirty);
|
||||||
|
if(!dirty) {
|
||||||
|
this.logger.clearAlerts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ function Logger(componentName,options) {
|
|||||||
this.save = "save" in options ? options.save : true;
|
this.save = "save" in options ? options.save : true;
|
||||||
this.saveLimit = options.saveLimit || 100 * 1024;
|
this.saveLimit = options.saveLimit || 100 * 1024;
|
||||||
this.buffer = "";
|
this.buffer = "";
|
||||||
|
this.alertCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -91,6 +92,7 @@ Logger.prototype.alert = function(/* args */) {
|
|||||||
component: this.componentName
|
component: this.componentName
|
||||||
};
|
};
|
||||||
existingCount = 0;
|
existingCount = 0;
|
||||||
|
this.alertCount += 1;
|
||||||
}
|
}
|
||||||
alertFields.modified = new Date();
|
alertFields.modified = new Date();
|
||||||
if(++existingCount > 1) {
|
if(++existingCount > 1) {
|
||||||
@ -108,6 +110,18 @@ Logger.prototype.alert = function(/* args */) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Clear outstanding alerts
|
||||||
|
*/
|
||||||
|
Logger.prototype.clearAlerts = function() {
|
||||||
|
if(this.alertCount > 0) {
|
||||||
|
$tw.utils.each($tw.wiki.getTiddlersWithTag(ALERT_TAG),function(title) {
|
||||||
|
$tw.wiki.deleteTiddler(title);
|
||||||
|
});
|
||||||
|
this.alertCount = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.Logger = Logger;
|
exports.Logger = Logger;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user