diff options
Diffstat (limited to 'scripts/lib/extensions.js')
-rw-r--r-- | scripts/lib/extensions.js | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/scripts/lib/extensions.js b/scripts/lib/extensions.js index 5f1f086f..2e6d163e 100644 --- a/scripts/lib/extensions.js +++ b/scripts/lib/extensions.js @@ -1,41 +1,40 @@ -Object.defineProperties(extensions, { - "warning" : { - value : function (name, message) { - io.print("\033[1mDWB EXTENSION WARNING: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr"); - } - }, - "error" : { - value : function (name, message) { - io.print("\033[31mDWB EXTENSION ERROR: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr"); +(function () { + var _config = undefined; + function getPlugin(name, filename) { + var ret = null; + try { + if (io.fileTest(filename, FileTest.exists)) { + ret = include(filename); + } } - }, - "message" : { - value : function (name, message) { - io.print("\033[1mDWB EXTENSION: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr"); + catch(e) { + extensions.error(name, "Error in line " + e.line + " parsing " + filename); } - }, - "load" : { - value : (function () { - var _config = undefined; - function getPlugin(name, filename) { - var ret = null; - try { - if (io.fileTest(filename, FileTest.exists)) { - ret = include(filename); - } - } - catch(e) { - extensions.error(name, "Error in line " + e.line + " parsing " + filename); - } - return ret; + return ret; + } + Object.defineProperties(extensions, { + "warning" : { + value : function (name, message) { + io.print("\033[1mDWB EXTENSION WARNING: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr"); } - - return function(name, c) { + }, + "error" : { + value : function (name, message) { + io.print("\033[31mDWB EXTENSION ERROR: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr"); + } + }, + "message" : { + value : function (name, message) { + io.print("\033[1mDWB EXTENSION: \033[0mextension \033[1m" + name + "\033[0m: " + message, "stderr"); + } + }, + "load" : { + value : function(name, c) { var boldname = "\033[1m" + name + "\033[0m"; var config, dataBase, pluginPath, plugin = null; var extConfig = null; - + /* Get default config if the config hasn't been read yet */ if (arguments.length == 2) { extConfig = c; @@ -84,7 +83,8 @@ Object.defineProperties(extensions, { extensions.error(name, "Initialization failed: " + e); return false; } - }; - })() - } -}); + } + } + }); +})(); +Object.freeze(extensions); |