@jss-rule-engine/chat
Version:
19 lines (18 loc) • 733 B
JavaScript
var ChatActionFactory = /** @class */ (function () {
function ChatActionFactory() {
this.registeredActions = new Map();
}
ChatActionFactory.prototype.registerAction = function (commandName, action) {
this.registeredActions.set(commandName, action);
};
ChatActionFactory.prototype.getAction = function (commandName) {
console.log('Registered action', this.registeredActions);
var actionClass = this.registeredActions.get(commandName);
if (actionClass) {
return new actionClass();
}
throw new Error("No action found for templateId: ".concat(commandName));
};
return ChatActionFactory;
}());
export { ChatActionFactory };