You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
693 B
30 lines
693 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
var Dispatcher = function Dispatcher() {
|
|
var _this = this;
|
|
|
|
_classCallCheck(this, Dispatcher);
|
|
|
|
this.callbacks = {};
|
|
this.data = {};
|
|
|
|
this.update = function (namespace) {
|
|
(_this.callbacks[namespace] || []).forEach(function (callback) {
|
|
try {
|
|
var data = _this.data[namespace];
|
|
callback(data);
|
|
} catch (e) {
|
|
callback(undefined);
|
|
}
|
|
});
|
|
};
|
|
};
|
|
|
|
exports.default = Dispatcher; |