mirror of
https://github.com/thelounge/thelounge
synced 2024-11-11 07:04:18 +00:00
Delay save function
This commit is contained in:
parent
152395d303
commit
40f8a4ddc4
1 changed files with 13 additions and 1 deletions
|
@ -320,7 +320,18 @@ Client.prototype.quit = function() {
|
|||
});
|
||||
};
|
||||
|
||||
Client.prototype.save = function() {
|
||||
var timer;
|
||||
Client.prototype.save = function(force) {
|
||||
var client = this;
|
||||
|
||||
if (!force) {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {
|
||||
client.save(true);
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
var name = this.name;
|
||||
var path = Helper.HOME + "/users/" + name + "/user.json";
|
||||
|
||||
|
@ -343,6 +354,7 @@ Client.prototype.save = function() {
|
|||
json.networks = networks;
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFile(
|
||||
|
|
Loading…
Reference in a new issue