mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-12 23:54:38 +02:00
* Trailing LF handling is now 'trailingLF' option, with 'default', 'yes', 'no', etc.
* Initial checking of WIP Mystery Skulls theme by Luciano Ayres of blocktronics * Fix random theme selection * WIP on theme customization apply: Needs to be much more flexible than current * MenuModule will use .next > .fallback > default fallback
This commit is contained in:
parent
68b8af7975
commit
05812f57f0
25 changed files with 187 additions and 105 deletions
|
@ -11,6 +11,7 @@ var events = require('events');
|
|||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var hjson = require('hjson');
|
||||
var _ = require('lodash');
|
||||
|
||||
function ConfigCache() {
|
||||
events.EventEmitter.call(this);
|
||||
|
@ -54,21 +55,29 @@ function ConfigCache() {
|
|||
|
||||
util.inherits(ConfigCache, events.EventEmitter);
|
||||
|
||||
ConfigCache.prototype.getConfig = function(filePath, cb) {
|
||||
var self = this;
|
||||
ConfigCache.prototype.getConfigWithOptions = function(options, cb) {
|
||||
assert(_.isString(options.filePath));
|
||||
|
||||
if(filePath in this.cache) {
|
||||
cb(null, this.cache[filePath], false);
|
||||
} else {
|
||||
this.reCacheConfigFromFile(filePath, function fileCached(err, config) {
|
||||
if(!err) {
|
||||
self.gaze.add(filePath);
|
||||
var self = this;
|
||||
var isCached = (options.filePath in this.cache);
|
||||
|
||||
if(options.forceReCache || !isCached) {
|
||||
this.reCacheConfigFromFile(options.filePath, function fileCached(err, config) {
|
||||
if(!err && !isCached) {
|
||||
self.gaze.add(options.filePath);
|
||||
}
|
||||
cb(err, config, true);
|
||||
});
|
||||
} else {
|
||||
cb(null, this.cache[options.filePath], false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ConfigCache.prototype.getConfig = function(filePath, cb) {
|
||||
this.getConfigWithOptions( { filePath : filePath }, cb);
|
||||
};
|
||||
|
||||
ConfigCache.prototype.getModConfig = function(fileName, cb) {
|
||||
this.getConfig(paths.join(Config.paths.mods, fileName), cb);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue