
                (function() {
                    var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
                    var __module = nodeEnv ? module : {exports:{}};
                    var __filename = 'preview-scripts/assets/Script/module/Notification/Notification.js';
                    var __require = nodeEnv ? function (request) {
                        return cc.require(request);
                    } : function (request) {
                        return __quick_compile_project__.require(request, __filename);
                    };
                    function __define (exports, require, module) {
                        if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"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();
                    }
                    if (nodeEnv) {
                        __define(__module.exports, __require, __module);
                    }
                    else {
                        __quick_compile_project__.registerModuleFunc(__filename, function () {
                            __define(__module.exports, __require, __module);
                        });
                    }
                })();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFzc2V0c1xcU2NyaXB0XFxtb2R1bGVcXE5vdGlmaWNhdGlvblxcTm90aWZpY2F0aW9uLnRzIl0sIm5hbWVzIjpbXS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WFrO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuXHJcbiAgICBvZmZNYXNnSWQ6IGZ1bmN0aW9uIChtYXNnSWQpIHtcclxuICAgICAgICB0aGlzLl9ldmVudE1hcFttYXNnSWRdID0gdW5kZWZpbmVkO1xyXG4gICAgfSxcclxuXHJcbiAgICByZW1vdmVBbGxNc2c6IGZ1bmN0aW9uICgpIHtcclxuICAgICAgICBmb3IgKGxldCBrIGluIHRoaXMuX2V2ZW50TWFwKSB7XHJcbiAgICAgICAgICAgIGlmICh0aGlzLl9ldmVudE1hcFtrXSkge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5vZmZNYXNnSWQoayk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICB9XHJcbn07XHJcbmV4cG9ydCB7IE5vdGlmaWNhdGlvbnMgfTsiXX0=