"use strict";
cc._RF.push(module, '55403VjGlpPL564gsdiZBg3', 'Notification');
// Script/module/Notification/Notification.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Notifications = void 0;
//全局通知
var Notifications = {
    _eventMap: [],
    on: function (masgId, callback, target) {
        if (this._eventMap[masgId] === undefined) {
            this._eventMap[masgId] = [];
        }
        this._eventMap[masgId].push({ callback: callback, target: target });
    },
    emit: function (masgId, parameter) {
        var array = this._eventMap[masgId];
        if (array === undefined)
            return;
        for (var i = 0; i < array.length; i++) {
            var element = array[i];
            if (element)
                element.callback.call(element.target, parameter);
        }
    },
    off: function (masgId, callback) {
        var array = this._eventMap[masgId];
        if (array === undefined)
            return;
        for (var i = 0; i < array.length; i++) {
            var element = array[i];
            if (element && element.callback === callback) {
                array[i] = undefined;
                break;
            }
        }
    },
    offMasgId: function (masgId) {
        this._eventMap[masgId] = undefined;
    },
    removeAllMsg: function () {
        for (var k in this._eventMap) {
            if (this._eventMap[k]) {
                this.offMasgId(k);
            }
        }
    }
};
exports.Notifications = Notifications;

cc._RF.pop();