Plugin list can now be reloaded 'live'

This commit is contained in:
Egil Moeller 2012-03-19 17:16:49 +01:00
parent 6fe7f2c2b2
commit c591efb352
6 changed files with 152 additions and 83 deletions

View file

@ -40,14 +40,14 @@ exports.callAll = function (hook_name, args) {
}
exports.aCallAll = function (hook_name, args, cb) {
if (plugins.hooks[hook_name] === undefined) cb([]);
if (plugins.hooks[hook_name] === undefined) return cb(null, []);
async.map(
plugins.hooks[hook_name],
function (hook, cb) {
hookCallWrapper(hook, hook_name, args, function (res) { cb(null, res); });
},
function (err, res) {
cb(exports.flatten(res));
cb(null, exports.flatten(res));
}
);
}
@ -58,8 +58,8 @@ exports.callFirst = function (hook_name, args) {
}
exports.aCallFirst = function (hook_name, args, cb) {
if (plugins.hooks[hook_name][0] === undefined) cb([]);
hookCallWrapper(plugins.hooks[hook_name][0], hook_name, args, function (res) { cb(exports.flatten(res)); });
if (plugins.hooks[hook_name][0] === undefined) return cb(null, []);
hookCallWrapper(plugins.hooks[hook_name][0], hook_name, args, function (res) { cb(null, exports.flatten(res)); });
}
exports.callAllStr = function(hook_name, args, sep, pre, post) {