preact-batteries
Version:
Batteries for you projects with Preact, TypeScript (or Babel)
16 lines (15 loc) • 468 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var Dispatcher = (function () {
function Dispatcher() {
this.callbacks = [];
}
Dispatcher.prototype.register = function (callback) {
this.callbacks.push(callback);
};
Dispatcher.prototype.dispatch = function (payload) {
this.callbacks.forEach(function (c) { return c(payload); });
};
return Dispatcher;
}());
exports.default = Dispatcher;