This commit is contained in:
Barış Soner Uşaklı
2018-10-18 15:15:54 -04:00
parent da1a90a470
commit 250e8c01ff
3 changed files with 46 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
var meta = require('./meta');
var pubsub = require('./pubsub');
function expandObjBy(obj1, obj2) {
var key;
@@ -68,6 +69,8 @@ function Settings(hash, version, defCfg, callback, forceUpdate, reset) {
this.hash = hash;
this.version = version || this.version;
this.defCfg = defCfg;
var self = this;
if (reset) {
this.reset(callback);
} else {
@@ -75,6 +78,11 @@ function Settings(hash, version, defCfg, callback, forceUpdate, reset) {
this.checkStructure(callback, forceUpdate);
});
}
pubsub.on('action:settings.set.' + hash, function (data) {
try {
self.cfg._ = JSON.parse(data._);
} catch (err) {}
});
}
Settings.prototype.hash = '';