UNPKG

@robotlegsjs/core

Version:

An architecture-based IoC framework for JavaScript/TypeScript

131 lines 4.3 kB
"use strict"; // ------------------------------------------------------------------------------ // Copyright (c) 2017-present, RobotlegsJS. All Rights Reserved. // // NOTICE: You are permitted to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // ------------------------------------------------------------------------------ Object.defineProperty(exports, "__esModule", { value: true }); exports.CommandMapping = void 0; var getQualifiedClassName_1 = require("../../../framework/impl/getQualifiedClassName"); /** * @private */ var CommandMapping = /** @class */ (function () { /*============================================================================*/ /* Constructor */ /*============================================================================*/ /** * Creates a Command Mapping * * @param commandClass The concrete Command class */ function CommandMapping(commandClass) { this._guards = []; this._hooks = []; this._fireOnce = false; this._payloadInjectionEnabled = true; this._commandClass = commandClass; } Object.defineProperty(CommandMapping.prototype, "commandClass", { /*============================================================================*/ /* Public Properties */ /*============================================================================*/ /** * @inheritDoc */ get: function () { return this._commandClass; }, enumerable: false, configurable: true }); Object.defineProperty(CommandMapping.prototype, "guards", { /** * @inheritDoc */ get: function () { return this._guards; }, enumerable: false, configurable: true }); Object.defineProperty(CommandMapping.prototype, "hooks", { /** * @inheritDoc */ get: function () { return this._hooks; }, enumerable: false, configurable: true }); Object.defineProperty(CommandMapping.prototype, "fireOnce", { /** * @inheritDoc */ get: function () { return this._fireOnce; }, enumerable: false, configurable: true }); Object.defineProperty(CommandMapping.prototype, "payloadInjectionEnabled", { /** * @inheritDoc */ get: function () { return this._payloadInjectionEnabled; }, enumerable: false, configurable: true }); /*============================================================================*/ /* Public Functions */ /*============================================================================*/ /** * @inheritDoc */ CommandMapping.prototype.addGuards = function () { var guards = []; for (var _i = 0; _i < arguments.length; _i++) { guards[_i] = arguments[_i]; } this._guards = this._guards.concat.apply(this._guards, guards); return this; }; /** * @inheritDoc */ CommandMapping.prototype.addHooks = function () { var hooks = []; for (var _i = 0; _i < arguments.length; _i++) { hooks[_i] = arguments[_i]; } this._hooks = this._hooks.concat.apply(this._hooks, hooks); return this; }; /** * @inheritDoc */ CommandMapping.prototype.setFireOnce = function (value) { this._fireOnce = value; return this; }; /** * @inheritDoc */ CommandMapping.prototype.setPayloadInjectionEnabled = function (value) { this._payloadInjectionEnabled = value; return this; }; /** * */ CommandMapping.prototype.toString = function () { return "Command " + getQualifiedClassName_1.getQualifiedClassName(this._commandClass); }; return CommandMapping; }()); exports.CommandMapping = CommandMapping; //# sourceMappingURL=CommandMapping.js.map