Skip to content

Commit

Permalink
fix conf settings in preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
todbot committed Jan 23, 2018
1 parent cd446af commit f3bd030
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions app/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,21 @@ if( ! fs.existsSync(conf_file) ) {
nconf.file({file: conf_file});

var Config = {
saveTimer:null,
// start: function() {
// var logconfig = this.readSettings('logger');
// // log.setConfig( logconfig );
// },
saveSettings: function(settingKey, settingValue) {
// console.log("saving key:",settingKey);
nconf.set(settingKey, settingValue);
//nconf.save();
this.queueSave();
nconf.save();
},
saveSettingsMem: function(settingKey, settingValue) {
nconf.set(settingKey, settingValue);
},
// save settings to disk (after multiple saveSettingsMem() calls)
saveSettingsSync: function() {
nconf.save();
},
readSettings: function(settingKey) {
nconf.load();
Expand All @@ -57,20 +62,6 @@ var Config = {
return conf_file;
// return nconf.stores.file.file; //FIXME: seems weird
},
queueSave: function() {
var self = this;
if( !self.saveTimer ) {
// console.log("queueSave: starting timer");
self.saveTimer = setTimeout( function() {
nconf.save();
self.saveTimer = null;
// console.log("queueSave: saved!");
}, 1000 );
}
else { // do nothing, wait for timer to expire to save us
// console.log("queueSave: timer already started")
}
}
// getUserDataHome: function() {
// var userDataHome = app.getPath('userData');
// return userDataHome;
Expand Down

0 comments on commit f3bd030

Please sign in to comment.