context.emit('cmd:ls',1,2,3);
context.on('module:ls',(a,b,c,evt) {
evt.count
});
before:
context.with('module1','module2')
.do((module1,module2) => {
// Do things with modules
}).else(() => {
// Module does not exists
});
after:
context.with('module1','module2',(module) => {
// Do things with modules
}).else(() => {
// Modules does not exists
});
before:
context.with('module',(module) => {
module.method(arg);
});
after:
// String is regular expression
var ret = context.call('module:method',arg);
var ret2 = context.call('(module1|module2):method',arg);
ret result:
ret: [ {name:'module1', result: ...}],
ret2: [ {name:'module1', result: ...}, {name: 'module2', result:...}]
although it only works with flat methods (i.e methods exported in module.exports)