
                (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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iAgICAgICAgICAgIHRoaXMuX2V2ZW50TWFwW21hc2dJZF0gPSBbXTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLl9ldmVudE1hcFttYXNnSWRdLnB1c2goeyBjYWxsYmFjazogY2FsbGJhY2ssIHRhcmdldDogdGFyZ2V0IH0pO1xuICAgIH0sXG5cbiAgICBlbWl0OiBmdW5jdGlvbiAobWFzZ0lkLCBwYXJhbWV0ZXIpIHtcbiAgICAgICAgbGV0IGFycmF5ID0gdGhpcy5fZXZlbnRNYXBbbWFzZ0lkXTtcbiAgICAgICAgaWYgKGFycmF5ID09PSB1bmRlZmluZWQpIHJldHVybjtcblxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFycmF5Lmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICBsZXQgZWxlbWVudCA9IGFycmF5W2ldO1xuICAgICAgICAgICAgaWYgKGVsZW1lbnQpIGVsZW1lbnQuY2FsbGJhY2suY2FsbChlbGVtZW50LnRhcmdldCwgcGFyYW1ldGVyKTtcbiAgICAgICAgfVxuICAgIH0sXG5cbiAgICBvZmY6IGZ1bmN0aW9uIChtYXNnSWQsIGNhbGxiYWNrKSB7XG4gICAgICAgIGxldCBhcnJheSA9IHRoaXMuX2V2ZW50TWFwW21hc2dJZF07XG4gICAgICAgIGlmIChhcnJheSA9PT0gdW5kZWZpbmVkKSByZXR1cm47XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyYXkubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIGxldCBlbGVtZW50ID0gYXJyYXlbaV07XG4gICAgICAgICAgICBpZiAoZWxlbWVudCAmJiBlbGVtZW50LmNhbGxiYWNrID09PSBjYWxsYmFjaykge1xuICAgICAgICAgICAgICAgIGFycmF5W2ldID0gdW5kZWZpbmVkO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSxcblxuICAgIG9mZk1hc2dJZDogZnVuY3Rpb24gKG1hc2dJZCkge1xuICAgICAgICB0aGlzLl9ldmVudE1hcFttYXNnSWRdID0gdW5kZWZpbmVkO1xuICAgIH0sXG5cbiAgICByZW1vdmVBbGxNc2c6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgZm9yIChsZXQgayBpbiB0aGlzLl9ldmVudE1hcCkge1xuICAgICAgICAgICAgaWYgKHRoaXMuX2V2ZW50TWFwW2tdKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5vZmZNYXNnSWQoayk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9XG59O1xuZXhwb3J0IHsgTm90aWZpY2F0aW9ucyB9OyJdfQ==