Repository URL to install this package:
Version:
0.9.6 ▾
|
"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;
};
Object.defineProperty(exports, "__esModule", { value: true });
const mobx_1 = require("xmobx/mobx");
class IncrementerState {
constructor() {
this.shouldIncrement = true;
this.shouldDecrement = false;
}
incrementCount(props) {
const { maxValue, step } = props;
if (this.count < maxValue) {
this.count += step;
this.shouldDecrement = true;
}
if (this.count === maxValue) {
this.shouldIncrement = false;
}
}
decrementCount(props) {
const { step } = props;
if (this.count > 1) {
this.count -= step;
this.shouldIncrement = true;
}
if (this.count === 1) {
this.shouldDecrement = false;
}
}
}
__decorate([
mobx_1.observable
], IncrementerState.prototype, "count", void 0);
__decorate([
mobx_1.observable
], IncrementerState.prototype, "shouldIncrement", void 0);
__decorate([
mobx_1.observable
], IncrementerState.prototype, "shouldDecrement", void 0);
__decorate([
mobx_1.action.bound
], IncrementerState.prototype, "incrementCount", null);
__decorate([
mobx_1.action.bound
], IncrementerState.prototype, "decrementCount", null);
exports.IncrementerState = IncrementerState;
//# sourceMappingURL=state.js.map