mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Cache node locales by language
This commit is contained in:
		| @@ -24,7 +24,7 @@ var events; | ||||
| var settings; | ||||
| var loader; | ||||
|  | ||||
| var nodeConfigCache = null; | ||||
| var nodeConfigCache = {}; | ||||
| var moduleConfigs = {}; | ||||
| var nodeList = []; | ||||
| var nodeConstructors = {}; | ||||
| @@ -39,7 +39,7 @@ function init(_settings,_loader, _events) { | ||||
|     nodeTypeToId = {}; | ||||
|     nodeConstructors = {}; | ||||
|     nodeList = []; | ||||
|     nodeConfigCache = null; | ||||
|     nodeConfigCache = {}; | ||||
| } | ||||
|  | ||||
| function load() { | ||||
| @@ -210,7 +210,7 @@ function addModule(module) { | ||||
|     if (module.examples) { | ||||
|         library.addExamplesDir(module.name,module.examples.path); | ||||
|     } | ||||
|     nodeConfigCache = null; | ||||
|     nodeConfigCache = {}; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -233,7 +233,7 @@ function removeNode(id) { | ||||
|     }); | ||||
|     config.enabled = false; | ||||
|     config.loaded = false; | ||||
|     nodeConfigCache = null; | ||||
|     nodeConfigCache = {}; | ||||
|     return filterNodeInfo(config); | ||||
| } | ||||
|  | ||||
| @@ -389,7 +389,7 @@ function registerNodeConstructor(nodeSet,type,constructor) { | ||||
| } | ||||
|  | ||||
| function getAllNodeConfigs(lang) { | ||||
|     if (!nodeConfigCache) { | ||||
|     if (!nodeConfigCache[lang]) { | ||||
|         var result = ""; | ||||
|         var script = ""; | ||||
|         for (var i=0;i<nodeList.length;i++) { | ||||
| @@ -407,9 +407,9 @@ function getAllNodeConfigs(lang) { | ||||
|         //    result += UglifyJS.minify(script, {fromString: true}).code; | ||||
|         //    result += '</script>'; | ||||
|         //} | ||||
|         nodeConfigCache = result; | ||||
|         nodeConfigCache[lang] = result; | ||||
|     } | ||||
|     return nodeConfigCache; | ||||
|     return nodeConfigCache[lang]; | ||||
| } | ||||
|  | ||||
| function getNodeConfig(id,lang) { | ||||
| @@ -448,7 +448,7 @@ function getNodeConstructor(type) { | ||||
| } | ||||
|  | ||||
| function clear() { | ||||
|     nodeConfigCache = null; | ||||
|     nodeConfigCache = {}; | ||||
|     moduleConfigs = {}; | ||||
|     nodeList = []; | ||||
|     nodeConstructors = {}; | ||||
| @@ -477,7 +477,7 @@ function enableNodeSet(typeOrId) { | ||||
|         config = moduleConfigs[getModule(id)].nodes[getNode(id)]; | ||||
|         delete config.err; | ||||
|         config.enabled = true; | ||||
|         nodeConfigCache = null; | ||||
|         nodeConfigCache = {}; | ||||
|         settings.enableNodeSettings(config.types); | ||||
|         return saveNodeList().then(function() { | ||||
|             return filterNodeInfo(config); | ||||
| @@ -500,7 +500,7 @@ function disableNodeSet(typeOrId) { | ||||
|         config = moduleConfigs[getModule(id)].nodes[getNode(id)]; | ||||
|         // TODO: persist setting | ||||
|         config.enabled = false; | ||||
|         nodeConfigCache = null; | ||||
|         nodeConfigCache = {}; | ||||
|         settings.disableNodeSettings(config.types); | ||||
|         return saveNodeList().then(function() { | ||||
|             return filterNodeInfo(config); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user