* Clean up some "JSON" nameing in config to reflect generic config or HJSON
* Found why "r" wasn't working for reply in menu.hjson... now it crashes though because actionKeys extraArgs broken it seems
This commit is contained in:
parent
1b46506cf8
commit
899cb658cc
|
@ -19,10 +19,9 @@ function ConfigCache() {
|
||||||
this.cache = {}; // filePath -> HJSON
|
this.cache = {}; // filePath -> HJSON
|
||||||
this.gaze = new Gaze();
|
this.gaze = new Gaze();
|
||||||
|
|
||||||
this.reCacheJSONFromFile = function(filePath, cb) {
|
this.reCacheConfigFromFile = function(filePath, cb) {
|
||||||
fs.readFile(filePath, { encoding : 'utf-8' }, function fileRead(err, data) {
|
fs.readFile(filePath, { encoding : 'utf-8' }, function fileRead(err, data) {
|
||||||
try {
|
try {
|
||||||
//self.cache[filePath] = JSON.parse(stripJsonComments(data));
|
|
||||||
self.cache[filePath] = hjson.parse(data);
|
self.cache[filePath] = hjson.parse(data);
|
||||||
cb(null, self.cache[filePath]);
|
cb(null, self.cache[filePath]);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
@ -40,11 +39,11 @@ function ConfigCache() {
|
||||||
this.gaze.on('changed', function fileChanged(filePath) {
|
this.gaze.on('changed', function fileChanged(filePath) {
|
||||||
assert(filePath in self.cache);
|
assert(filePath in self.cache);
|
||||||
|
|
||||||
Log.info( { filePath : filePath }, 'JSON file changed; recaching');
|
Log.info( { filePath : filePath }, 'Configuration file changed; recaching');
|
||||||
|
|
||||||
self.reCacheJSONFromFile(filePath, function reCached(err) {
|
self.reCacheConfigFromFile(filePath, function reCached(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
Log.error( { error : err, filePath : filePath } , 'Error recaching JSON');
|
Log.error( { error : err, filePath : filePath } , 'Error recaching HJSON config');
|
||||||
} else {
|
} else {
|
||||||
self.emit('recached', filePath);
|
self.emit('recached', filePath);
|
||||||
}
|
}
|
||||||
|
@ -61,11 +60,11 @@ ConfigCache.prototype.getConfig = function(filePath, cb) {
|
||||||
if(filePath in this.cache) {
|
if(filePath in this.cache) {
|
||||||
cb(null, this.cache[filePath], false);
|
cb(null, this.cache[filePath], false);
|
||||||
} else {
|
} else {
|
||||||
this.reCacheJSONFromFile(filePath, function fileCached(err, json) {
|
this.reCacheConfigFromFile(filePath, function fileCached(err, config) {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
self.gaze.add(filePath);
|
self.gaze.add(filePath);
|
||||||
}
|
}
|
||||||
cb(err, json, true);
|
cb(err, config, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -542,25 +542,25 @@
|
||||||
*/
|
*/
|
||||||
// :TODO: Need similar to viewId for actionKeys for specifis, e.g. viewId + index type stuff
|
// :TODO: Need similar to viewId for actionKeys for specifis, e.g. viewId + index type stuff
|
||||||
{
|
{
|
||||||
"keys" : [ "p", "shift + p" ],
|
keys: [ "p", "shift + p" ]
|
||||||
"action" : "@method:prevMessage"
|
action: @method:prevMessage
|
||||||
},
|
}
|
||||||
{
|
{
|
||||||
keys: [ "n", "shift + n" ]
|
keys: [ "n", "shift + n" ]
|
||||||
action: @method:nextMessage
|
action: @method:nextMessage
|
||||||
},
|
}
|
||||||
{
|
{
|
||||||
"keys" : [ "escape", "q", "shift + q" ],
|
keys: [ "escape", "q", "shift + q" ]
|
||||||
"action" : "@menu:messageArea"
|
action: @menu:messageArea
|
||||||
},
|
}
|
||||||
// :TODO: why the fuck is 'r' not working but 'n' for example does?
|
// :TODO: why the fuck is 'r' not working but 'n' for example does?
|
||||||
{
|
{
|
||||||
keys: : [ "r", "shift + r" ]
|
keys: [ "r", "shift + r" ]
|
||||||
action: @method:replyMessage
|
action: @method:replyMessage
|
||||||
extraArgs: {
|
extraArgs: {
|
||||||
menu: messageAreaReplyPost
|
menu: messageAreaReplyPost
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
{
|
{
|
||||||
"keys" : [ "down arrow", "up arrow", "page up", "page down" ],
|
"keys" : [ "down arrow", "up arrow", "page up", "page down" ],
|
||||||
"action" : "@method:movementKeyPressed"
|
"action" : "@method:movementKeyPressed"
|
||||||
|
|
Loading…
Reference in New Issue