@macrof/shared
Version:
React MicroFrontend Shared, Typescript, Webpack 5, ModuleFederation
99 lines (98 loc) • 3.37 kB
JavaScript
;
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.LoaderService = void 0;
const inversify_1 = require("inversify");
const mobx_1 = require("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([
mobx_1.observable,
__metadata("design:type", Object)
], LoaderService.prototype, "$showCount", void 0);
__decorate([
mobx_1.observable,
__metadata("design:type", Object)
], LoaderService.prototype, "$show", void 0);
__decorate([
mobx_1.observable,
__metadata("design:type", Object)
], LoaderService.prototype, "$background", void 0);
__decorate([
mobx_1.computed,
__metadata("design:type", Boolean),
__metadata("design:paramtypes", [])
], LoaderService.prototype, "isShow", null);
__decorate([
mobx_1.computed,
__metadata("design:type", Boolean),
__metadata("design:paramtypes", [Boolean])
], LoaderService.prototype, "isBackground", null);
__decorate([
mobx_1.action.bound,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], LoaderService.prototype, "show", null);
__decorate([
mobx_1.action.bound,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], LoaderService.prototype, "hide", null);
__decorate([
mobx_1.action.bound,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Boolean, Boolean]),
__metadata("design:returntype", void 0)
], LoaderService.prototype, "update", null);
__decorate([
mobx_1.action.bound,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], LoaderService.prototype, "hideFromOutside", null);
LoaderService = __decorate([
(0, inversify_1.injectable)()
], LoaderService);
exports.LoaderService = LoaderService;