mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 18:00:26 +00:00
Partial fix for #1570
Stop the logger from creating alert tiddlers on the server. They propagate to the client but are not deletable from the client because they are in the `$:/temp` namespace. cc @loleg
This commit is contained in:
parent
0e75a6f41c
commit
550ad4a1a9
@ -36,6 +36,8 @@ Alert a message
|
|||||||
Logger.prototype.alert = function(/* args */) {
|
Logger.prototype.alert = function(/* args */) {
|
||||||
// Prepare the text of the alert
|
// Prepare the text of the alert
|
||||||
var text = Array.prototype.join.call(arguments," ");
|
var text = Array.prototype.join.call(arguments," ");
|
||||||
|
// Create alert tiddlers in the browser
|
||||||
|
if($tw.browser) {
|
||||||
// Check if there is an existing alert with the same text and the same component
|
// Check if there is an existing alert with the same text and the same component
|
||||||
var existingAlerts = $tw.wiki.getTiddlersWithTag(ALERT_TAG),
|
var existingAlerts = $tw.wiki.getTiddlersWithTag(ALERT_TAG),
|
||||||
alertFields,
|
alertFields,
|
||||||
@ -65,8 +67,12 @@ Logger.prototype.alert = function(/* args */) {
|
|||||||
alertFields.count = undefined;
|
alertFields.count = undefined;
|
||||||
}
|
}
|
||||||
$tw.wiki.addTiddler(new $tw.Tiddler(alertFields));
|
$tw.wiki.addTiddler(new $tw.Tiddler(alertFields));
|
||||||
// Log it too
|
// Log the alert as well
|
||||||
this.log.apply(this,Array.prototype.slice.call(arguments,0));
|
this.log.apply(this,Array.prototype.slice.call(arguments,0));
|
||||||
|
} else {
|
||||||
|
// Print an orange message to the console if not in the browser
|
||||||
|
console.error("\x1b[1;33m" + text + "\x1b[0m");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Logger = Logger;
|
exports.Logger = Logger;
|
||||||
|
Loading…
Reference in New Issue
Block a user