I have several different tools and each tool has many private and public functions. I use one JSON data file to store settings and data needed for the tools. This because our editors that has no coding knowledge should be able to change the settings and data in the JSON file and adapt all tools to their needs.
All tools are implemented in one module to be able to keep global variables and all tools encapsulated.
I use revealing module for all tools and one more to encapsulate all tools.
Example:
var mainModule = (function () {
var toolOne = (function () {
function publicFunc () {
console.log('Some toolOne action.');
}
return {
publicFunc: publicFunc;
}
})();
var toolTwo = (function () {
function publicFunc () {
console.log('Some toolTwo action.');
}
return {
publicFunc: publicFunc;
}
})();
return {
one: toolOne.publicFunc,
two: toolTwo.publicFunc
}
})();
mainModule.one();
mainModule.two();
Is there any better way to organize all tools? What is the best way to load JSON file asynchronously and use settings in all modules?