var t = require; var e = module; var i = exports; Object.defineProperty(i, "__esModule", {value: !0}), ((e = {})[(e.eventTarget = 0)] = "eventTarget"), (e[(e.eventsMap = 1)] = "eventsMap"), (e[(e.captureEventsMap = 2)] = "captureEventsMap"), (e[(e.notifyLevel = 3)] = "notifyLevel"), (i.default = class { constructor(t) { (this.notifyLevel = 0), (this.type = t), ObjectPool.registerClass(s, "MessageVo"), (this.dict = {}), (this.notifyLevel = 0), (this.eVec = new Array()), (this.lastRunTime = 0), this.type; } clear() { (this.dict = {}), this.eVec.splice(0); } addListener(t, e, i, s) { s = 0 | +s; let o = -1; var a = this.dict[t]; null == a ? (this.dict[t] = a = []) : 0 !== this.notifyLevel && (this.dict[t] = a = a.concat()); for (var n = 0, r = a.length; n < r; n++) { if (a[n][0] == e && a[n][1] == i) return; -1 == o && a[n][2] < s && (o = n); } t = [e, i, s]; return -1 !== o ? a.splice(o, 0, t) : a.push(t), t; } removeListener(t, e, i) { var s = this.dict[t]; if (null != s) { 0 !== this.notifyLevel && (this.dict[t] = s = s.concat()); for (var o = 0, a = s.length; o < a; o++) if (s[o][0] == e && s[o][1] == i) { s.splice(o, 1); break; } 0 == s.length && ((this.dict[t] = null), delete this.dict[t]); } } removeAll(t) { for (var e = Object.keys(this.dict), i = 0, s = e.length; i < s; i++) { var o = e[i], a = this.dict[o]; 0 !== this.notifyLevel && (this.dict[o] = a = a.concat()); for (var n = 0; n < a.length; n++) a[n][1] == t && (a.splice(n, 1), n--); 0 == a.length && ((this.dict[o] = null), delete this.dict[o]); } } dispatch(t, ...e) { var i; null != this.dict[t] && (((i = ObjectPool.pop("MessageVo")).type = t), (i.param = e), 0 == this.type ? this.eVec.push(i) : 1 == this.type ? this.dealMsg(i) : Log.trace("MessageCenter未实现的类型")); } run() {} dealMsg(t) { var e = this.dict[t.type], i = 0, s = e.length, o = null; for (this.notifyLevel++; i < s; ) { o = e[i]; try { o[0].apply(o[1], t.param); } catch (t) { Log.error("消息处理出错:", t.toString()); } i++; } this.notifyLevel--, t.dispose(), ObjectPool.push(t); } }); class s { constructor() { this.ObjectPoolKey = null; } dispose() { (this.type = null), (this.param = null); } }