Allow universal modules to have multiple listeners in inner

This commit is contained in:
yflory 2021-03-30 15:18:58 +02:00
parent 96892bff48
commit 08073f4853
1 changed files with 3 additions and 4 deletions

View File

@ -212,9 +212,8 @@ define([
var modules = {};
funcs.makeUniversal = function (type, cfg) {
if (cfg && cfg.onEvent) {
modules[type] = {
onEvent: cfg.onEvent || function () {}
};
modules[type] = modules[type] || Util.mkEvent();
modules[type].reg(cfg.onEvent);
}
var sframeChan = funcs.getSframeChannel();
return {
@ -833,7 +832,7 @@ define([
ctx.sframeChan.on('EV_UNIVERSAL_EVENT', function (obj) {
var type = obj.type;
if (!type || !modules[type]) { return; }
modules[type].onEvent(obj.data);
modules[type].fire(obj.data);
});
ctx.cache = Cache.create(ctx.sframeChan);