UNPKG

@macrof/shared

Version:

React MicroFrontend Shared, Typescript, Webpack 5, ModuleFederation

96 lines (95 loc) 3.19 kB
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); }; import { injectable } from 'inversify'; import { action, computed, observable } from 'mobx'; let LoaderService = class LoaderService { constructor() { this.$showCount = 0; this.$show = false; this.$background = true; } get isShow() { return this.$show; } get isBackground() { return this.$background; } set isBackground(value) { this.$background = value; } show() { this.$show = true; this.$showCount += 1; } hide() { this.$showCount -= 1; if (this.$showCount === 0) { this.hideFromOutside(); } } update(isShow, isBackground) { this.$show = isShow; this.$background = isBackground; } hideFromOutside() { this.$show = false; this.isBackground = true; } }; __decorate([ observable, __metadata("design:type", Object) ], LoaderService.prototype, "$showCount", void 0); __decorate([ observable, __metadata("design:type", Object) ], LoaderService.prototype, "$show", void 0); __decorate([ observable, __metadata("design:type", Object) ], LoaderService.prototype, "$background", void 0); __decorate([ computed, __metadata("design:type", Boolean), __metadata("design:paramtypes", []) ], LoaderService.prototype, "isShow", null); __decorate([ computed, __metadata("design:type", Boolean), __metadata("design:paramtypes", [Boolean]) ], LoaderService.prototype, "isBackground", null); __decorate([ action.bound, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], LoaderService.prototype, "show", null); __decorate([ action.bound, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], LoaderService.prototype, "hide", null); __decorate([ action.bound, __metadata("design:type", Function), __metadata("design:paramtypes", [Boolean, Boolean]), __metadata("design:returntype", void 0) ], LoaderService.prototype, "update", null); __decorate([ action.bound, __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0) ], LoaderService.prototype, "hideFromOutside", null); LoaderService = __decorate([ injectable() ], LoaderService); export { LoaderService };