UNPKG

react-application-core

Version:

A react-based application core for the business applications.

87 lines 3.21 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StoreProxy = void 0; var util_1 = require("../../../util"); var di_1 = require("../../../di"); var StoreProxy = /** @class */ (function () { /** * @stable [30.03.2020] * @param {IGenericContainer<TProps extends IGenericContainerProps>} container */ function StoreProxy(container) { this.container = container; } /** * @stable [03.10.2019] * @param {string} type * @param {TChanges} data */ StoreProxy.prototype.dispatch = function (type, data) { this.dispatchActionByType(this.sectionName + "." + type, util_1.SectionUtils.applySection(this.sectionName, data)); }; /** * @stable [11.09.2019] * @param {string} type * @param {TData} data */ StoreProxy.prototype.dispatchActionByType = function (type, data) { this.dispatchPlainAction({ type: type, data: data }); }; /** * @stable [24.03.2020] * @param {IEffectsAction} action */ StoreProxy.prototype.dispatchPlainAction = function (action) { this.appStore.dispatch(action); }; Object.defineProperty(StoreProxy.prototype, "sectionName", { /** * @stable [11.09.2019] * @returns {string} */ get: function () { return this.props.sectionName; }, enumerable: false, configurable: true }); /** * @stable [03.02.2020] * @param {string} otherSection * @returns {string} */ StoreProxy.prototype.asSection = function (otherSection) { return otherSection || this.sectionName; }; Object.defineProperty(StoreProxy.prototype, "props", { /** * @stable [11.09.2019] * @returns {TProps} */ get: function () { return this.container.props; }, enumerable: false, configurable: true }); __decorate([ di_1.lazyInject(di_1.DI_TYPES.Settings), __metadata("design:type", Object) ], StoreProxy.prototype, "settings", void 0); __decorate([ di_1.lazyInject(di_1.DI_TYPES.Store), __metadata("design:type", Object) ], StoreProxy.prototype, "appStore", void 0); return StoreProxy; }()); exports.StoreProxy = StoreProxy; //# sourceMappingURL=store.proxy.js.map